public class SimpleHashableStateFactory extends java.lang.Object implements HashableStateFactory
HashableState
objects from
State
instances. It produces either a IISimpleHashableState
or a
IDSimpleHashableState
.
The general approach is that hash values are computed by iterating through each
variable key in the order returned by State.variableKeys()
and the has code for values returned by
State.get(Object)
are combined. Similarly, two states are evaluated as equal when the values returned by
State.get(Object)
satisfy their implemented Object.equals(Object)
method.
This class also automatically provides special treatment for OO-MDP states (states that implement
OOState
) by being object identifier independent
(the names of objects don't affect the state identity). However, you may disable identifier independence
by using the constructor SimpleHashableStateFactory(boolean)
. If your domain is relational, it may be
important to be identifier *dependent* (that is, set the parameter in the constructor to false).
Modifier and Type | Field and Description |
---|---|
protected boolean |
identifierIndependent
Whether state evaluations of OO-MDPs are object identifier independent (the names of objects don't matter).
|
Constructor and Description |
---|
SimpleHashableStateFactory()
Default constructor: object identifier independent and no hash code caching.
|
SimpleHashableStateFactory(boolean identifierIndependent)
Initializes with no hash code caching.
|
Modifier and Type | Method and Description |
---|---|
HashableState |
hashState(State s)
Turns
State s into a HashableState |
boolean |
objectIdentifierIndependent() |
protected boolean identifierIndependent
public SimpleHashableStateFactory()
public SimpleHashableStateFactory(boolean identifierIndependent)
identifierIndependent
- if true then state evaluations for OOState
s are object identifier independent; if false then dependent.public HashableState hashState(State s)
HashableStateFactory
State
s into a HashableState
hashState
in interface HashableStateFactory
s
- the input State
to transform.HashableState
.public boolean objectIdentifierIndependent()