public class SparseCrossProductFeatures extends java.lang.Object implements SparseStateActionFeatures
SparseStateActionFeatures implementation that takes as input a SparseStateFeatures object,
 and turns it into state-action features taking the cross product of the features with the action set. This
 implementation is lazy and creates state-action features as they are queried. Consequently, the state-action feature indices
 for an action may not be consecutive.| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
SparseCrossProductFeatures.FeaturesMap  | 
| Modifier and Type | Field and Description | 
|---|---|
protected java.util.Map<Action,SparseCrossProductFeatures.FeaturesMap> | 
actionFeatures  | 
protected int | 
nextFeatureId  | 
protected SparseStateFeatures | 
sFeatures  | 
| Modifier | Constructor and Description | 
|---|---|
  | 
SparseCrossProductFeatures(SparseStateFeatures sFeatures)  | 
protected  | 
SparseCrossProductFeatures(SparseStateFeatures sFeatures,
                          java.util.Map<Action,SparseCrossProductFeatures.FeaturesMap> actionFeatures,
                          int nextFeatureId)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected int | 
actionFeature(Action a,
             int from)  | 
SparseCrossProductFeatures | 
copy()
Returns a deep copy of this features function. 
 | 
java.util.List<StateFeature> | 
features(State s,
        Action a)
Returns non-zero state-action features for a given state and action. 
 | 
int | 
numFeatures()
Returns the total number of features 
 | 
protected SparseStateFeatures sFeatures
protected java.util.Map<Action,SparseCrossProductFeatures.FeaturesMap> actionFeatures
protected int nextFeatureId
public SparseCrossProductFeatures(SparseStateFeatures sFeatures)
protected SparseCrossProductFeatures(SparseStateFeatures sFeatures, java.util.Map<Action,SparseCrossProductFeatures.FeaturesMap> actionFeatures, int nextFeatureId)
public java.util.List<StateFeature> features(State s, Action a)
SparseStateActionFeaturesfeatures in interface SparseStateActionFeaturess - the state for which features should be returneda - the action for which features should be returnedpublic SparseCrossProductFeatures copy()
SparseStateActionFeaturescopy in interface SparseStateActionFeaturespublic int numFeatures()
SparseStateActionFeaturesnumFeatures in interface SparseStateActionFeaturesprotected int actionFeature(Action a, int from)