aima.probability.decision.cellworld
Class CellWorld

java.lang.Object
  extended by aima.probability.decision.cellworld.CellWorld
All Implemented Interfaces:
MDPSource<CellWorldPosition,java.lang.String>

public class CellWorld
extends java.lang.Object
implements MDPSource<CellWorldPosition,java.lang.String>


Field Summary
static java.lang.String DOWN
           
static java.lang.String LEFT
           
static java.lang.String NO_OP
           
static java.lang.String RIGHT
           
static java.lang.String UP
           
 
Constructor Summary
CellWorld(int numberOfRows, int numberOfColumns, double initialReward)
           
 
Method Summary
 MDP<CellWorldPosition,java.lang.String> asMdp()
           
 MDPPerception<CellWorldPosition> execute(CellWorldPosition position, java.lang.String action, Randomizer r)
           
 java.util.List<java.lang.String> getAllActions()
           
 java.util.List<CellWorldPosition> getFinalStates()
           
 CellWorldPosition getInitialState()
           
 java.util.List<CellWorldPosition> getNonFinalStates()
           
 MDPRewardFunction<CellWorldPosition> getRewardFunction()
           
 MDPTransitionModel<CellWorldPosition,java.lang.String> getTransitionModel()
           
 double getTransitionProbability(CellWorldPosition startingPosition, java.lang.String actionDesired, CellWorldPosition endingPosition)
           
 boolean isBlocked(Pair<java.lang.Integer,java.lang.Integer> p)
           
 void markBlocked(int i, int j)
           
 CellWorldPosition moveProbabilisticallyFrom(int i, int j, java.lang.String direction, Randomizer r)
           
 void setReward(int i, int j, double reward)
           
 void setTerminalState(CellWorldPosition position)
           
 void setTerminalState(int i, int j)
           
 java.util.List<Cell> unblockedCells()
           
 java.util.List<CellWorldPosition> unblockedPositions()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final java.lang.String LEFT
See Also:
Constant Field Values

RIGHT

public static final java.lang.String RIGHT
See Also:
Constant Field Values

UP

public static final java.lang.String UP
See Also:
Constant Field Values

DOWN

public static final java.lang.String DOWN
See Also:
Constant Field Values

NO_OP

public static final java.lang.String NO_OP
See Also:
Constant Field Values
Constructor Detail

CellWorld

public CellWorld(int numberOfRows,
                 int numberOfColumns,
                 double initialReward)
Method Detail

markBlocked

public void markBlocked(int i,
                        int j)

moveProbabilisticallyFrom

public CellWorldPosition moveProbabilisticallyFrom(int i,
                                                   int j,
                                                   java.lang.String direction,
                                                   Randomizer r)

setReward

public void setReward(int i,
                      int j,
                      double reward)

unblockedCells

public java.util.List<Cell> unblockedCells()

isBlocked

public boolean isBlocked(Pair<java.lang.Integer,java.lang.Integer> p)

getTransitionProbability

public double getTransitionProbability(CellWorldPosition startingPosition,
                                       java.lang.String actionDesired,
                                       CellWorldPosition endingPosition)

getTransitionModel

public MDPTransitionModel<CellWorldPosition,java.lang.String> getTransitionModel()
Specified by:
getTransitionModel in interface MDPSource<CellWorldPosition,java.lang.String>

getRewardFunction

public MDPRewardFunction<CellWorldPosition> getRewardFunction()
Specified by:
getRewardFunction in interface MDPSource<CellWorldPosition,java.lang.String>

unblockedPositions

public java.util.List<CellWorldPosition> unblockedPositions()

asMdp

public MDP<CellWorldPosition,java.lang.String> asMdp()
Specified by:
asMdp in interface MDPSource<CellWorldPosition,java.lang.String>

getNonFinalStates

public java.util.List<CellWorldPosition> getNonFinalStates()
Specified by:
getNonFinalStates in interface MDPSource<CellWorldPosition,java.lang.String>

getFinalStates

public java.util.List<CellWorldPosition> getFinalStates()
Specified by:
getFinalStates in interface MDPSource<CellWorldPosition,java.lang.String>

setTerminalState

public void setTerminalState(int i,
                             int j)

setTerminalState

public void setTerminalState(CellWorldPosition position)

getInitialState

public CellWorldPosition getInitialState()
Specified by:
getInitialState in interface MDPSource<CellWorldPosition,java.lang.String>

execute

public MDPPerception<CellWorldPosition> execute(CellWorldPosition position,
                                                java.lang.String action,
                                                Randomizer r)
Specified by:
execute in interface MDPSource<CellWorldPosition,java.lang.String>

getAllActions

public java.util.List<java.lang.String> getAllActions()
Specified by:
getAllActions in interface MDPSource<CellWorldPosition,java.lang.String>