public abstract class ObjectParameterizedAction extends Action
Action implementation is paramerterized to OO-MDP ObjectInstance
references, you can subclass this Action subclass to easily provide that functionality. The GroundedAction
instance associated with this action is ObjectParameterizedAction.ObjectParameterizedGroundedAction,
which implements the AbstractObjectParameterizedGroundedAction, since its parameters refer to
OO-MDP ObjectInstance references.
ObjectParameterizedAction(String, burlap.oomdp.core.Domain, String[]) constructor
specifies the valid type of ObjectClass
to which the parameters must belong. For example, in BlocksWorld,
we might define a "stack" ObjectParameterizedAction that takes two parameters
that each must be instances of the BLOCK class. In such a case, the String array passed to the constructor of the stack
ObjectParameterizedAction would be new String[]{"BLOCK", "BLOCK"}.
ObjectParameterizedAction is unimportant.
For example, a cooking domain might have a "combine"
action that combines two INGREDIENT objects. In such a case, the effect of combine(ing1, ing2) would be the same as combine(ing2, ing1).
Our action definition can include this parameter symmetry information by assigning parameters to the same parameter order group.
The order of parameters in the same parameter order group and be swapped without affecting results, but the order of parameters in different groups
cannot be swapped without affecting performance. By default
the parameter order group of parameters are all assumed to be different, which means the order of the parameters is important. However,
by using the ObjectParameterizedAction(String, burlap.oomdp.core.Domain, String[], String[]) method, each parameter can also be set
to a parameter order group. For example, the parameterClasses of the combine action would be new String[]{INGREDIENT, INGREDIENT}, and
the parameterOrderGroups would be new String[]{g1, g1}, thereby placing them in the same group to indicate that their order
is unimportant. Specifying parameter order groups is useful because it allows the list of ObjectParameterizedAction.ObjectParameterizedGroundedAction
instances returned by the getAllApplicableGroundedActions(burlap.oomdp.core.states.State) method to exclude
multiple parameterizations that have the same effect.| Modifier and Type | Class and Description |
|---|---|
static class |
ObjectParameterizedAction.ObjectParameterizedGroundedAction |
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String[] |
parameterClasses
The object classes each parameter of this action can accept; empty list for a parameter-less action (which is the default)
|
protected java.lang.String[] |
parameterOrderGroup
Specifies the parameter order group each parameter.
|
actionObservers, domain, name| Constructor and Description |
|---|
ObjectParameterizedAction(java.lang.String name,
Domain domain,
java.lang.String[] parameterClasses)
Initializes the action with the name of the action, the domain to which it belongs, and the parameters it takes.
|
ObjectParameterizedAction(java.lang.String name,
Domain domain,
java.lang.String[] parameterClasses,
java.lang.String[] parameterOrderGroups)
Initializes the action with the name of the action, the domain to which it belongs, the parameters it takes, and the parameter order groups.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<GroundedAction> |
getAllApplicableGroundedActions(State s)
Returns all possible groundings of this action that can be applied in the provided
State. |
GroundedAction |
getAssociatedGroundedAction()
Returns a
GroundedAction instance that points to this Action,
but does not have any parameters--if any--set. |
java.lang.String[] |
getParameterClasses()
Returns a String array of the names of of the object classes to which bound parameters must belong
|
java.lang.String[] |
getParameterOrderGroups()
Returns the a String array specifying the parameter order group of each parameter.
|
boolean |
isParameterized()
Returns true if this action is parameterized; false otherwise.
|
abstract boolean |
parametersAreObjectIdentifierIndependent() |
addActionObserver, applicableInState, clearAllActionsObservers, deterministicTransition, equals, getAllApplicableGroundedActionsFromActionList, getDomain, getGroundedAction, getName, hashCode, isPrimitive, performAction, performActionHelper, performInEnvironmentprotected java.lang.String[] parameterClasses
protected java.lang.String[] parameterOrderGroup
public ObjectParameterizedAction(java.lang.String name,
Domain domain,
java.lang.String[] parameterClasses)
name - the name of the actiondomain - the domain to which the action belongsparameterClasses - a String array of the names of the object classes to which bound parameters must belongpublic ObjectParameterizedAction(java.lang.String name,
Domain domain,
java.lang.String[] parameterClasses,
java.lang.String[] parameterOrderGroups)
name - the name of the actiondomain - the domain to which the action belongsparameterClasses - a String array of the names of the object classes to which bound parameters must belongparameterOrderGroups - the order group assignments for each of the parameters.public final java.lang.String[] getParameterClasses()
public final java.lang.String[] getParameterOrderGroups()
public abstract boolean parametersAreObjectIdentifierIndependent()
public boolean isParameterized()
ActionisParameterized in class ActionAction is parameterized; false if it is not.public GroundedAction getAssociatedGroundedAction()
ActionGroundedAction instance that points to this Action,
but does not have any parameters--if any--set.getAssociatedGroundedAction in class ActionGroundedAction instance.public java.util.List<GroundedAction> getAllApplicableGroundedActions(State s)
ActionState. To check if a grounded
action is applicable in the state, the Action.applicableInState(State, burlap.oomdp.singleagent.GroundedAction) method is checked.
The default behavior of this method is to treat the parameters as possible object bindings, finding all bindings
that satisfy the object class typing specified and then checking them against the Action.applicableInState(State, burlap.oomdp.singleagent.GroundedAction)
method. However, this class can also be overridden to provide custom
grounding behavior or non-object based parametrization.getAllApplicableGroundedActions in class Actions - the State in which all applicable grounded actions of this Action object should be returned.GroundedActions of this Action object in in the given State