/** * Create the cell world as defined in Figure 17.1 in AIMA3e. (a) A simple 4 * x 3 environment that presents the agent with a sequential decision * problem. * * @return a cell world representation of Fig 17.1 in AIMA3e. */ public static CellWorld<Double> createCellWorldForFig17_1() { CellWorld<Double> cw = new CellWorld<Double>(4, 3, -0.04); cw.removeCell(2, 2); cw.getCellAt(4, 3).setContent(1.0); cw.getCellAt(4, 2).setContent(-1.0); return cw; }
/** * Constructs an MDP that can be used to generate the utility values * detailed in Fig 17.3. * * @param cw * the cell world from figure 17.1. * @return an MDP that can be used to generate the utility values detailed * in Fig 17.3. */ public static MarkovDecisionProcess <Cell <Double>, CellWorldAction> createMDPForFigure17_3( CellWorld <Double> cw) { return(new MDP <Cell <Double>, CellWorldAction>(cw.getCells(), cw.getCellAt(1, 1), createActionsFunctionForFigure17_1(cw), createTransitionProbabilityFunctionForFigure17_1(cw), createRewardFunctionForFigure17_1())); }
/** * Returns the allowed actions from a specified cell within the cell world * described in Fig 17.1. * * @param cw * the cell world from figure 17.1. * @return the set of actions allowed at a particular cell. This set will be * empty if at a terminal state. */ public static ActionsFunction <Cell <Double>, CellWorldAction> createActionsFunctionForFigure17_1( CellWorld <Double> cw) { Set <Cell <Double> > terminals = new Set <Cell <Double> >(); terminals.add(cw.getCellAt(4, 3)); terminals.add(cw.getCellAt(4, 2)); ActionsFunction <Cell <Double>, CellWorldAction> af = null; //new ActionsFunction<Cell<Double>, CellWorldAction>() { //}; // TODO return(af); }