|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.iastate.jrelm.rl.AbstractStatelessPolicy<I,A>
edu.iastate.jrelm.rl.SimpleStatelessPolicy<I,A>
I
- - the type used to identify Actions.A
- - the type of Action used.public class SimpleStatelessPolicy<I,A extends Action>
A simple implementation of the StatelessPolicy interface. This is essentially a discrete probability distribution governing the choice of Action from a given ActionDomain, irrespective of the state of the world. To be used with a ReinforcementLearner implementing a stateless algorithm.
Field Summary | |
---|---|
protected java.util.ArrayList<I> |
actionIDList
|
protected ActionDomain<I,A> |
domain
|
protected SimpleEventGenerator |
eventGenerator
|
protected A |
lastAction
|
protected double[] |
probDistFunction
Here a probability distribution function (pdf) is an array of probability values. |
protected cern.jet.random.engine.RandomEngine |
randomEngine
|
Constructor Summary | |
---|---|
SimpleStatelessPolicy(ActionDomain<I,A> actionDomain)
Construct a SimpleStatelessPolicy using a given ActionDomain. |
|
SimpleStatelessPolicy(ActionDomain<I,A> actionDomain,
double[] initProbs)
A new MersenneTwister seeded with the current time ((int)System.currentTimeMillis()) is created as the RandomEngine for this policy. |
|
SimpleStatelessPolicy(ActionDomain<I,A> actionDomain,
double[] initProbs,
int randSeed)
|
|
SimpleStatelessPolicy(ActionDomain<I,A> actionDomain,
double[] initProbs,
cern.jet.random.engine.RandomEngine randomGen)
Note: RandomGenerator does not reveal the seed value being used. |
|
SimpleStatelessPolicy(ActionDomain<I,A> actionDomain,
int randSeed)
Construct a SimplePolicy using the given ActionDomain and psuedo-random generator seed. |
|
SimpleStatelessPolicy(ActionDomain<I,A> actionDomain,
cern.jet.random.engine.RandomEngine randomGen)
Construct a SimpleStatelessPolicy using a given ActionDomain and RandomEngine. |
Method Summary | |
---|---|
A |
generateAction()
Choose an Action according to the current probability distribution function. |
ActionDomain<I,A> |
getActionDomain()
Get the set of actions this policy uses. |
double[] |
getDistribution()
Retrieve the probability distribution used in selecting actions from the action domain. |
A |
getLastAction()
Get the last action chosen by this policy. |
int |
getNumActions()
Retrieve the number of possible actions in the DiscreteFiniteDomain for this policy. |
double |
getProbability(I actionID)
Gets the current probability of choosing an action. |
int |
getRandomSeed()
|
protected void |
init()
|
void |
reset()
Reset this policy. |
void |
setDistribution(double[] distrib)
Set the probability distribution used in selecting actions from the action domain. |
void |
setProbability(I actionID,
double newValue)
Updates the probability of choosing the indicated Action |
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 edu.iastate.jrelm.rl.AbstractStatelessPolicy |
---|
generateAction, getProbability, getStateDomain, setProbability |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double[] probDistFunction
protected cern.jet.random.engine.RandomEngine randomEngine
protected SimpleEventGenerator eventGenerator
protected ActionDomain<I,A extends Action> domain
protected java.util.ArrayList<I> actionIDList
protected A extends Action lastAction
Constructor Detail |
---|
public SimpleStatelessPolicy(ActionDomain<I,A> actionDomain)
actionList
- - the collection of possible actions this policy learns overMersenneTwister
public SimpleStatelessPolicy(ActionDomain<I,A> actionDomain, int randSeed)
aDomain
- - the collection of possible ActionssDomain
- - the collection of possible StatesrandSeed
- - seed value for the random generator used in this policyMersenneTwister
public SimpleStatelessPolicy(ActionDomain<I,A> actionDomain, cern.jet.random.engine.RandomEngine randomGen)
actionList
- - the collection of possible actions this policy learns overrandomGen
- - the RandomEngine this policy will usepublic SimpleStatelessPolicy(ActionDomain<I,A> actionDomain, double[] initProbs)
MersenneTwister
public SimpleStatelessPolicy(ActionDomain<I,A> actionDomain, double[] initProbs, int randSeed) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public SimpleStatelessPolicy(ActionDomain<I,A> actionDomain, double[] initProbs, cern.jet.random.engine.RandomEngine randomGen) throws java.lang.IllegalArgumentException
actionDomain
- initProbs
- randomGen
-
java.lang.IllegalArgumentException
Method Detail |
---|
protected void init()
public A generateAction()
public void reset()
public double[] getDistribution()
public void setDistribution(double[] distrib) throws java.lang.IllegalArgumentException
distrib
- - the new collection of action choice probabilities
java.lang.IllegalArgumentException
public ActionDomain<I,A> getActionDomain()
edu.iastate.jrelm.rl.StatelessPolicy#getDomain()
public int getNumActions()
public A getLastAction()
StatelessPolicy.getLastAction()
public double getProbability(I actionID)
actionIndex
- - int indicator of which action to look up
Policy#getProbability(SI, AI)
public void setProbability(I actionID, double newValue)
actionID
- - the index of the desired Action in this policy's ActionDomain.newValue
- - new choice probability value to associate with this action.Policy#setProbability(SI, AI, double)
public void setRandomEngine(cern.jet.random.engine.RandomEngine engine)
engine
- public int getRandomSeed()
public void setRandomSeed(int seed)
seed
- - seed valuecern.jet.random.engine.MersenneTwister
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |