public interface State
ObjectInstance
interface). Each object has its own value assignment to a set of attributes. OO-MDPs can represent
a very large range of different kinds of MDP problems and so you can typically formulate any MDP state as an OO-MDP
state. Two standard implementations of State include MutableState
and
ImmutableState
which store state information as explicit collections of
MutableObjectInstance
and ImmutableObjectInstance
objects.
However, in special cases and for efficiency reasons, you may want make a custom implementation of State
that maintains state information in a different way. For full compatibility with all BURLAP tools, like the Visualizer
,
and for making using of the existing HashableStateFactory
implementations, you should make
sure you implement the OO-MDP methods of this interface, even if your State
implementation
does not explicitly store some collection of ObjectInstance
elements. However,
if you are willing to write your own implementations of those tools for a custom State
implementation that does not implement all the methods, you can do so. For example, If your State
implementation does not implement all OO-MDP methods, you can write your own HashableStateFactory
to work with it and then use any BURLAP tabular planning or learning algorithm, like AStar
,
ValueIteration
, etc.Modifier and Type | Method and Description |
---|---|
State |
addAllObjects(java.util.Collection<ObjectInstance> objects)
Adds the collection of objects to the state
|
State |
addObject(ObjectInstance o)
Adds object instance o to this state.
|
State |
copy()
Returns a copy of this state, if mutable the copy should be deep.
|
java.util.List<ObjectInstance> |
getAllObjects()
Returns the list of observable and hidden object instances in this state.
|
java.util.List<java.util.List<ObjectInstance>> |
getAllObjectsByClass()
Returns a list of list of object instances, grouped by object class
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getAllUnsetAttributes()
Returns a mapping from object instance names to the list of attributes names that have unset values.
|
java.lang.String |
getCompleteStateDescription()
Returns a string representation of this state using observable and hidden object instances.
|
java.lang.String |
getCompleteStateDescriptionWithUnsetAttributesAsNull()
Returns a string description of the state with unset attribute values listed as null.
|
ObjectInstance |
getFirstObjectOfClass(java.lang.String oclass)
Returns the first indexed object of the object class named oclass
|
ObjectInstance |
getObject(java.lang.String oname)
Returns the object in this state with the name oname
|
java.util.Set<java.lang.String> |
getObjectClassesPresent()
Returns a set of of the object class names for all object classes that have instantiated objects in this state.
|
java.util.Map<java.lang.String,java.lang.String> |
getObjectMatchingTo(State so,
boolean enforceStateExactness)
This method computes a matching from objects in the receiver to value-identical objects in the parameter state so.
|
java.util.List<ObjectInstance> |
getObjectsOfClass(java.lang.String oclass)
Returns all objects that belong to the object class named oclass
|
java.util.List<java.util.List<java.lang.String>> |
getPossibleBindingsGivenParamOrderGroups(java.lang.String[] paramClasses,
java.lang.String[] paramOrderGroups)
Given an array of parameter object classes and an array of their corresponding parameter order groups,
returns all possible object instance bindings to the parameters, excluding bindings that are equivalent due
to the parameter order grouping.
|
int |
numTotalObjects()
Returns the number of object instances in this state.
|
State |
removeAllObjects(java.util.Collection<ObjectInstance> objects)
Removes the collection of objects from the state
|
State |
removeObject(ObjectInstance o)
Removes the object instance o from this state.
|
State |
removeObject(java.lang.String oname)
Removes the object instance with the name oname from this state.
|
State |
renameObject(ObjectInstance o,
java.lang.String newName)
Renames the identifier for object instance o in this state to newName.
|
State |
renameObject(java.lang.String originalName,
java.lang.String newName)
Renames the identifier for the object instance currently named originalName with the name newName.
|
<T> State |
setObjectsValue(java.lang.String objectName,
java.lang.String attName,
T value) |
State copy()
State addObject(ObjectInstance o)
o
- the object instance to be added to this state.State addAllObjects(java.util.Collection<ObjectInstance> objects)
objects
- State removeObject(java.lang.String oname)
oname
- the name of the object instance to remove.<T> State setObjectsValue(java.lang.String objectName, java.lang.String attName, T value)
State removeObject(ObjectInstance o)
o
- the object instance to remove from this state.State removeAllObjects(java.util.Collection<ObjectInstance> objects)
objects
- State renameObject(java.lang.String originalName, java.lang.String newName)
originalName
- the original name of the object instance to be renamed in this statenewName
- the new name of the object instanceState renameObject(ObjectInstance o, java.lang.String newName)
o
- the object instance to rename in this statenewName
- the new name of the object instancejava.util.Map<java.lang.String,java.lang.String> getObjectMatchingTo(State so, boolean enforceStateExactness)
so
- the state to whose objects the receiving state's objects should be matchedenforceStateExactness
- whether to require that states are identical to return a matchingint numTotalObjects()
ObjectInstance getObject(java.lang.String oname)
oname
- the name of the object instance to returnjava.util.List<ObjectInstance> getAllObjects()
java.util.List<ObjectInstance> getObjectsOfClass(java.lang.String oclass)
oclass
- the name of the object class for which objects should be returnedObjectInstance getFirstObjectOfClass(java.lang.String oclass)
oclass
- the name of the object class for which the first indexed object should be returned.java.util.Set<java.lang.String> getObjectClassesPresent()
java.util.List<java.util.List<ObjectInstance>> getAllObjectsByClass()
java.lang.String getCompleteStateDescription()
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllUnsetAttributes()
java.lang.String getCompleteStateDescriptionWithUnsetAttributesAsNull()
java.util.List<java.util.List<java.lang.String>> getPossibleBindingsGivenParamOrderGroups(java.lang.String[] paramClasses, java.lang.String[] paramOrderGroups)
paramClasses
- the name of object classes to which the bound object instances must belongparamOrderGroups
- the parameter order group names.