public class FVToFeatureDatabase extends java.lang.Object implements FeatureDatabase
StateToFeatureVectorGenerator
into a
FeatureDatabase
. One advantage of this approach is that this can be used
to automatically construct state-action features. Specifically, the state features produced but the
StateToFeatureVectorGenerator
are duplicated into unique features for
each possible action. The duplication of features for actions is lazy. That is, every time a previously unseen
action is queried in the getActionFeaturesSets(burlap.oomdp.core.states.State, java.util.List)
method,
it gets new state features assigned to it.Modifier and Type | Field and Description |
---|---|
protected java.util.Map<GroundedAction,java.lang.Integer> |
actionFeatureMultiplier
A map for returning a multiplier to the number of state features for each action.
|
protected int |
dim
The dimensionality of the state features produced by the feature vector generator
|
protected StateToFeatureVectorGenerator |
fvGen
The state feature vector generator
|
protected int |
nextActionMultiplier
The next action Fourier basis function size multiplier to use for the next newly seen action.
|
Constructor and Description |
---|
FVToFeatureDatabase(StateToFeatureVectorGenerator fvGen,
int dim)
Initializes.
|
Modifier and Type | Method and Description |
---|---|
FVToFeatureDatabase |
copy()
Returns a deep copy of this feature database.
|
void |
freezeDatabaseState(boolean toggle)
Enable or disable the database from generating new features.
|
java.util.List<ActionFeaturesQuery> |
getActionFeaturesSets(State s,
java.util.List<GroundedAction> actions)
Returns non-zero action features for all of provided actions in state s.
|
protected int |
getActionMultiplier(GroundedAction ga)
This method returns the action multiplier for the specified grounded action.
|
java.util.List<StateFeature> |
getStateFeatures(State s)
Returns non-zero state features for a given state.
|
int |
numberOfFeatures()
Returns the number of features this database tracks.
|
protected StateToFeatureVectorGenerator fvGen
protected int dim
protected java.util.Map<GroundedAction,java.lang.Integer> actionFeatureMultiplier
protected int nextActionMultiplier
public FVToFeatureDatabase(StateToFeatureVectorGenerator fvGen, int dim)
fvGen
- The state feature vector generatordim
- The dimensionality of the state features produced by the feature vector generatorpublic java.util.List<StateFeature> getStateFeatures(State s)
FeatureDatabase
getStateFeatures
in interface FeatureDatabase
s
- the state for which features should be returnedpublic java.util.List<ActionFeaturesQuery> getActionFeaturesSets(State s, java.util.List<GroundedAction> actions)
FeatureDatabase
getActionFeaturesSets
in interface FeatureDatabase
s
- the state for which features should be returnedactions
- the action set for which the action features should be returnedpublic void freezeDatabaseState(boolean toggle)
FeatureDatabase
freezeDatabaseState
in interface FeatureDatabase
public int numberOfFeatures()
FeatureDatabase
numberOfFeatures
in interface FeatureDatabase
protected int getActionMultiplier(GroundedAction ga)
ga
- the grounded action for which the multiplier will be returnedpublic FVToFeatureDatabase copy()
FeatureDatabase
copy
in interface FeatureDatabase