All Packages Class Hierarchy This Package Previous Next Index
Class sim.mdp.Hall
java.lang.Object
|
+----sim.mdp.MDP
|
+----sim.mdp.Hall
- public class Hall
- extends MDP
A Markov Chain that takes a state and returns a new state and a reinforcement.
If the next state is fed back in as the state, it can run a simulation. If the
state is repeatedly randomized, it can be used for learning
with random transitions. The chain has boundaries of [-1,1]. The number of
states is dependent upon dt. The reinforcement on each transition is 1 and state
1 is an absorbing state with a value of 0.
This code is (c) 1996 Mance E. Harmon
<harmonme@aa.wpafb.af.mil>,
http://www.aa.wpafb.af.mil/~harmonme
The source and object code may be redistributed freely provided
no fee is charged. If the code is modified, please state so
in the comments.
- Version:
- 1.07, 22 Aug 97
- Author:
- Mance Harmon
-
Hall()
-
-
actionSize()
- Return the number of elements in the action vector.
-
findValAct(Matrix, Matrix, FunApp, Matrix, PBoolean)
- Find the value and best action of this state.
-
findValue(Matrix, Matrix, PDouble, FunApp, PDouble, Matrix, PDouble, PBoolean, NumExp, Random)
- Find the max over actions for where V(x') is the value of the successor state
given state x, R is the reinforcement, gamma is the discount factor.
-
getAction(Matrix, Matrix, Random)
- Return the next possible action in a state given an action.
-
getParameters(int)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
-
getState(Matrix, PDouble, Random)
- Return the next state when doing epoch-wise training.
-
initialAction(Matrix, Matrix, Random)
- Return an initial action possible in a given state.
-
initialState(Matrix, Random)
- Return a start state for epoch-wise training.
-
nextState(Matrix, Matrix, Matrix, PDouble, PBoolean, Random)
- Find the next state given a state and action,
and return the reinforcement received.
-
numActions(Matrix)
- Return the number of actions in each state.
-
numPairs(PDouble)
- Return the number of state/action pairs for a given dt.
-
numStates(PDouble)
- Return the number of states in this LQR for a given dt.
-
randomAction(Matrix, Matrix, Random)
- Generates a random action from those possible.
-
randomState(Matrix, Random)
- Generates a random state from those possible.
-
stateSize()
- Return the number of elements in the state vector.
Hall
public Hall()
getParameters
public Object[][] getParameters(int lang)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
- Overrides:
- getParameters in class MDP
- See Also:
- getParameters
numStates
public int numStates(PDouble dt)
- Return the number of states in this LQR for a given dt. The state space is the number line
from [-1,1] and is discretized in units of dt.
- Overrides:
- numStates in class MDP
stateSize
public int stateSize()
- Return the number of elements in the state vector.
- Overrides:
- stateSize in class MDP
initialState
public void initialState(Matrix state,
Random random) throws MatrixException
- Return a start state for epoch-wise training.
- Throws: MatrixException
- Vector is the wrong length.
- Overrides:
- initialState in class MDP
getState
public void getState(Matrix state,
PDouble dt,
Random random) throws MatrixException
- Return the next state when doing epoch-wise training.
This functions as a circular queue.
- Throws: MatrixException
- Vector is the wrong length.
- Overrides:
- getState in class MDP
actionSize
public int actionSize()
- Return the number of elements in the action vector.
- Overrides:
- actionSize in class MDP
numActions
public int numActions(Matrix state)
- Return the number of actions in each state.
- Overrides:
- numActions in class MDP
initialAction
public void initialAction(Matrix state,
Matrix action,
Random random) throws MatrixException
- Return an initial action possible in a given state.
- Throws: MatrixException
- Vector is the wrong length.
- Overrides:
- initialAction in class MDP
getAction
public void getAction(Matrix state,
Matrix action,
Random random) throws MatrixException
- Return the next possible action in a state given an action.
- Throws: MatrixException
- Vector is the wrong length.
- Overrides:
- getAction in class MDP
numPairs
public int numPairs(PDouble dt)
- Return the number of state/action pairs for a given dt.
This only works for dt's in which 2 is evenly divisible by dt.
- Overrides:
- numPairs in class MDP
randomAction
public void randomAction(Matrix state,
Matrix action,
Random random) throws MatrixException
- Generates a random action from those possible.
- Throws: MatrixException
- Vector is the wrong length.
- Overrides:
- randomAction in class MDP
randomState
public void randomState(Matrix state,
Random random) throws MatrixException
- Generates a random state from those possible.
- Throws: MatrixException
- Vector is the wrong length.
- Overrides:
- randomState in class MDP
nextState
public double nextState(Matrix state,
Matrix action,
Matrix newState,
PDouble dt,
PBoolean valueKnown,
Random random) throws MatrixException
- Find the next state given a state and action,
and return the reinforcement received.
All 3 should be vectors (single-column matrices).
The duration of the time step, dt, is also returned.
- Throws: MatrixException
- if sizes aren't right.
- Overrides:
- nextState in class MDP
findValAct
public double findValAct(Matrix state,
Matrix action,
FunApp f,
Matrix outputs,
PBoolean valueKnown) throws MatrixException
- Find the value and best action of this state.
- Throws: MatrixException
- column vectors are wrong size or shape
- Overrides:
- findValAct in class MDP
findValue
public double findValue(Matrix state,
Matrix action,
PDouble gamma,
FunApp f,
PDouble dt,
Matrix outputs,
PDouble reinforcement,
PBoolean valueKnown,
NumExp explorationFactor,
Random random) throws MatrixException
- Find the max over actions for where V(x') is the value of the successor state
given state x, R is the reinforcement, gamma is the discount factor. Return
This method is used in the object ValIteration (value iteration). The last performed in this
method should be done for the successor state associate with the optimal action.
In this case there is only one action.
- Throws: MatrixException
- column vectors are wrong size or shape
- Overrides:
- findValue in class MDP
All Packages Class Hierarchy This Package Previous Next Index