public void testExampleFromBookFigure4_6Page103() { MapEnvironment me = new MapEnvironment(aMap); MapAgent ma = new MapAgent( me, recursiveBestFirstSearch, new String[] {SimplifiedRoadMapOfPartOfRomania.BUCHAREST}); ma.setHeuristicFunction(heuristicFunction); me.addAgent(ma, SimplifiedRoadMapOfPartOfRomania.ARAD); me.registerView( new BasicEnvironmentView() { @Override public void envChanged(String command) { envChanges.append(command).append(":"); } }); me.stepUntilNoOp(); assertEquals( "CurrentLocation=In(Arad), Goal=In(Bucharest):Sibiu:Rimnicu Vilcea:Pitesti:Bucharest:METRIC[pathCost]=422.0:METRIC[maxRecursiveDepth]=4:METRIC[nodesExpanded]=6:NoOP:", envChanges.toString()); }
public void testStartingAtGoal() { MapEnvironment me = new MapEnvironment(aMap); MapAgent ma = new MapAgent( me, recursiveBestFirstSearch, new String[] {SimplifiedRoadMapOfPartOfRomania.BUCHAREST}); ma.setHeuristicFunction(heuristicFunction); me.addAgent(ma, SimplifiedRoadMapOfPartOfRomania.BUCHAREST); me.registerView( new BasicEnvironmentView() { @Override public void envChanged(String command) { envChanges.append(command).append(":"); } }); me.stepUntilNoOp(); assertEquals( "CurrentLocation=In(Bucharest), Goal=In(Bucharest):NoOP:METRIC[pathCost]=0.0:METRIC[maxRecursiveDepth]=0:METRIC[nodesExpanded]=0:NoOP:", envChanges.toString()); }