public abstract class SGAgentAction
extends java.lang.Object
SGAgent
) in a stochastic game. This class is analogous
to the single-agent action definition class, Action
, except it does
not include the transition dynamic information which is instead provided by a JointActionModel
that takes the simultaneous action selections of all agents in a game and determines the outcome.
SGAgentAction
is closely associated with an implementation of
the GroundedSGAgentAction
class. An GroundedSGAgentAction
differs from a SGAgentAction
in that the GroundedSGAgentAction
includes parameter assignment information necessary for the agent to execute the action.
applicableInState(burlap.oomdp.core.states.State, GroundedSGAgentAction)
, isParameterized()
, getAssociatedGroundedAction(String)
, andgetAllApplicableGroundedActions(burlap.oomdp.core.states.State, String)
. applicableInState(burlap.oomdp.core.states.State, GroundedSGAgentAction)
method defines the preconditions of the action definition. The latter three methods are important
for defining parameterized actions. Note that if you If you are defining a parameter-less action that has no
preconditions (can be executed in any state), then you may simply use the SimpleSGAgentAction
implementation for creating your action definition. Otherwise, the isParameterized()
method should
return true and you will also need to implementing the remaining methods.
GroundedSGAgentAction
implementation
stores a set of parameter assignments that need to be provided to apply your parameterized SGAgentAction
.
For custom parameterizations, you will need to subclass GroundedSGAgentAction
to include data
members for parameter assignments. The getAssociatedGroundedAction(String)
should then return an instance of your custom
GroundedSGAgentAction
with its GroundedSGAgentAction.action
datamember
pointing to this SGAgentAction
and its GroundedSGAgentAction.actingAgent
data member pointing to the actingAgent argument. The parameter assignments in the returned SGAgentAction
do not need to be specified; this method serves as a means for simply generating an instance of the associated GroundedAction
.
getAllApplicableGroundedActions(burlap.oomdp.core.states.State, String)
method should return a list of GroundedSGAgentAction
instances, covering all possible parameterizations of this action for the acting agent in the given state. However,
the returned list should only include GroundedSGAgentAction
instances that satisfy the
applicableInState(burlap.oomdp.core.states.State, GroundedSGAgentAction)
method.
GroundedSGAgentAction
subclass
is all that is required to implement a parameterized SGAgentAction
and by allowing you to
define your own subclass of GroundedSGAgentAction
,
you can have any kind of SGAgentAction
parametrization that you'd like.
That said, a common form of SGAgentAction
parameterization is an action that operates on OO-MDP
ObjectInstance
references in a state. If you would like to have a OO-MDP object parameterization,
rather than define your own subclass, you should consider subclassing the ObParamSGAgentAction
class. See it's documentation for more details.Modifier and Type | Field and Description |
---|---|
java.lang.String |
actionName |
SGDomain |
domain |
Constructor and Description |
---|
SGAgentAction(SGDomain d,
java.lang.String name)
Initializes this single action to be for the given domain and with the given name.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
applicableInState(State s,
GroundedSGAgentAction gsa)
Returns true if this action can be applied in the given state by the given agent with the given parameters.
|
boolean |
equals(java.lang.Object o) |
abstract java.util.List<GroundedSGAgentAction> |
getAllApplicableGroundedActions(State s,
java.lang.String actingAgent)
Returns all possible grounded versions of this single action for a given state and acting agent.
|
static java.util.List<GroundedSGAgentAction> |
getAllApplicableGroundedActionsFromActionList(State s,
java.lang.String actingAgent,
java.util.List<SGAgentAction> actions)
Returns all possible grounded versions of the provided list of SingleAction objects that an agent can take in the given state.
|
abstract GroundedSGAgentAction |
getAssociatedGroundedAction(java.lang.String actingAgent)
Returns a
GroundedSGAgentAction instance that
is associated with this SGAgentAction for
the provided acting agent, without any parameters set (if there are parameters to set). |
int |
hashCode() |
abstract boolean |
isParameterized()
Returns true if this action is parameterized.
|
public java.lang.String actionName
public SGDomain domain
public SGAgentAction(SGDomain d, java.lang.String name)
d
- the domain to which this action belongsname
- the name of this actionpublic abstract boolean applicableInState(State s, GroundedSGAgentAction gsa)
s
- the state in which the action would be executed.gsa
- a GroundedSGAgentAction
containing the agent name and any parameters of the actionpublic abstract boolean isParameterized()
public abstract GroundedSGAgentAction getAssociatedGroundedAction(java.lang.String actingAgent)
GroundedSGAgentAction
instance that
is associated with this SGAgentAction
for
the provided acting agent, without any parameters set (if there are parameters to set).actingAgent
- the name of the acting agentGroundedSGAgentAction
associated with this SGAgentAction
.public abstract java.util.List<GroundedSGAgentAction> getAllApplicableGroundedActions(State s, java.lang.String actingAgent)
s
- the state in which the agent would execute this actionactingAgent
- the agent who would execute the actionpublic static java.util.List<GroundedSGAgentAction> getAllApplicableGroundedActionsFromActionList(State s, java.lang.String actingAgent, java.util.List<SGAgentAction> actions)
s
- the state in which to execute actionsactingAgent
- the agent who will be executing the actionsactions
- the list of actions that to get the grounded version forpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object