|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.iastate.jrelm.rl.SimplePolicy<AI,A,SI,S>
S
- - the type of State managed by the given StateDomain.AI
- - the type of Action identifier used.A
- - the type of Action contained in the given ActionDomainpublic class SimplePolicy<AI,A extends Action,SI,S extends State>
A simple implementation of the Policy interface. This is essentially manages discrete probability distributions governing the choice of action based on the current state of the world. An action choice is represented as one Action object from a given ActionDomain. Similarly, the state of the world is represented as one State object from a given StateDomain. This is to be used with a ReinforcementLearner, which is responsible for updating this policy according to the reinforcement learning algorithm implemented.
Field Summary | |
---|---|
protected ActionDomain<AI,A> |
actionDomain
|
protected java.util.ArrayList<AI> |
actionIDList
|
protected ModifiedEmpiricalWalker |
eventGenerator
|
protected A |
lastAction
|
protected double[][] |
pdfs
|
protected cern.jet.random.engine.RandomEngine |
randomEngine
|
protected int |
randSeed
|
protected StateDomain<SI,S> |
stateDomain
|
protected java.util.ArrayList<SI> |
stateIDList
|
Constructor Summary | |
---|---|
SimplePolicy(ActionDomain<AI,A> aDomain,
StateDomain<SI,S> sDomain)
Construct a SimplePolicy using a given ActionDomain and StateDomain. |
|
SimplePolicy(ActionDomain<AI,A> aDomain,
StateDomain<SI,S> sDomain,
double[][] initPDFs)
Construct a SimplePolicy using the given ActionDomain, StateDomain, and initial probability distribution functions. |
|
SimplePolicy(ActionDomain<AI,A> aDomain,
StateDomain<SI,S> sDomain,
double[][] initPDFs,
int randSeed)
|
|
SimplePolicy(ActionDomain<AI,A> aDomain,
StateDomain<SI,S> sDomain,
double[][] initPDFs,
cern.jet.random.engine.RandomEngine randomGen)
|
|
SimplePolicy(ActionDomain<AI,A> aDomain,
StateDomain<SI,S> sDomain,
int randSeed)
Construct a SimplePolicy using a given ActionDomain, StateDomain and psuedo-random generator seed. |
|
SimplePolicy(ActionDomain<AI,A> aDomain,
StateDomain<SI,S> sDomain,
cern.jet.random.engine.RandomEngine randomGen)
Construct a SimplePolicy using a given ActionDomain and RandomEngine. |
Method Summary | |
---|---|
A |
generateAction(SI stateID)
Given the indentifier of the current State, choose an Action according to the current probability distribution function. |
A |
generateAction(State<SI> currentState)
Given the current State, choose an Action according to the current probability distribution function. |
ActionDomain<AI,A> |
getActionDomain()
Get the domain of action being used by this policy. |
double[][] |
getDistribution()
Retrieve the collection of probability distribution functions used in selecting Actions from the ActionDomain for all States in the StateDomain. |
double[] |
getDistribution(State<SI> aState)
Retrieve the probability distribution function used in selecting Actions from the ActionDomain in the given State. |
A |
getLastAction()
Get the last action chosen by this policy. |
int |
getNumActions()
Retrieve the number of Actions in this policy's ActionDomain. |
int |
getNumStates()
Retrieve the number of States in this policy's StateDomain. |
double |
getProbability(SI stateID,
AI actionID)
Look up the probability for a State-Action pair. |
int |
getRandomSeed()
|
StateDomain<SI,S> |
getStateDomain()
Get the domain of world state being used by this policy. |
protected void |
init()
|
void |
reset()
Reset this policy. |
void |
setDistribution(State<SI> aState,
double[] pdf)
Set the probability distribution function used in selecting Actions from the ActionDomain for the given State. |
void |
setProbability(SI stateID,
AI actionID,
double newValue)
Set a State-Action pair probability value. |
void |
setRandomEngine(cern.jet.random.engine.RandomEngine engine)
Sets the RandomEngine to be used by this policy. |
void |
setRandomSeed(int seed)
Resets the RandomEngine, initializing it with the given seed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double[][] pdfs
protected cern.jet.random.engine.RandomEngine randomEngine
protected ModifiedEmpiricalWalker eventGenerator
protected ActionDomain<AI,A extends Action> actionDomain
protected StateDomain<SI,S extends State> stateDomain
protected java.util.ArrayList<AI> actionIDList
protected java.util.ArrayList<SI> stateIDList
protected A extends Action lastAction
protected int randSeed
Constructor Detail |
---|
public SimplePolicy(ActionDomain<AI,A> aDomain, StateDomain<SI,S> sDomain)
aDomain
- - the collection of possible ActionssDomain
- - the collection of possible StatesMersenneTwister
public SimplePolicy(ActionDomain<AI,A> aDomain, StateDomain<SI,S> sDomain, int randSeed)
aDomain
- - the collection of possible ActionssDomain
- - the collection of possible StatesrandSeed
- - seed value for the random generator used in this policyMersenneTwister
public SimplePolicy(ActionDomain<AI,A> aDomain, StateDomain<SI,S> sDomain, cern.jet.random.engine.RandomEngine randomGen)
aDomain
- - the collection of possible ActionssDomain
- - the collection of possible StatesrandomGen
- - the RandomEngine to use. This policy employs a
ModifiedEmpiricalWalker in selecting Actions, which in turn uses a RandomEngine.RandomEngine
,
ModifiedEmpiricalWalker
public SimplePolicy(ActionDomain<AI,A> aDomain, StateDomain<SI,S> sDomain, double[][] initPDFs)
aDomain
- - the collection of possible ActionssDomain
- - the collection of possible StatesinitPDFs
- - an initial collection of pdfs used in selecting Actions for each State in
the StateDomain.public SimplePolicy(ActionDomain<AI,A> aDomain, StateDomain<SI,S> sDomain, double[][] initPDFs, int randSeed)
public SimplePolicy(ActionDomain<AI,A> aDomain, StateDomain<SI,S> sDomain, double[][] initPDFs, cern.jet.random.engine.RandomEngine randomGen) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
Method Detail |
---|
protected void init()
public A generateAction(State<SI> currentState)
public A generateAction(SI stateID)
generateAction
in interface Policy<AI,A extends Action,SI,S extends State>
public void reset()
public double[] getDistribution(State<SI> aState)
aState
- - the State for which to retrieve a an action choice pdf.
public double[][] getDistribution()
public void setDistribution(State<SI> aState, double[] pdf) throws java.lang.IllegalArgumentException
distrib
- - the new collection of Action choice probabilities
java.lang.IllegalArgumentException
public ActionDomain<AI,A> getActionDomain()
getActionDomain
in interface Policy<AI,A extends Action,SI,S extends State>
Policy.getActionDomain()
public StateDomain<SI,S> getStateDomain()
getStateDomain
in interface Policy<AI,A extends Action,SI,S extends State>
Policy.getStateDomain()
public int getNumActions()
public int getNumStates()
public A getLastAction()
getLastAction
in interface Policy<AI,A extends Action,SI,S extends State>
Policy.getLastAction()
public double getProbability(SI stateID, AI actionID)
getProbability
in interface Policy<AI,A extends Action,SI,S extends State>
stateID
- - the identifier indicating the desired state to look up an Action
probability foractionID
- - the identifier indicating the Action to look up a probability for.
public void setProbability(SI stateID, AI actionID, double newValue)
setProbability
in interface Policy<AI,A extends Action,SI,S extends State>
stateID
- - indicator of the desired State in this policy's StateDomain.actionID
- - indicator of the desired Action in this policy's ActionDomain.newValue
- - new choice probability value to associate with this State-Action pair.public void setRandomEngine(cern.jet.random.engine.RandomEngine engine)
engine
- public int getRandomSeed()
public void setRandomSeed(int seed)
setRandomSeed
in interface Policy<AI,A extends Action,SI,S extends State>
seed
- - seed valuecern.jet.random.engine.MersenneTwister
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |