use of aima.core.agent.Action in project aima-java by aimacode.
the class UniformCostSearchTest method testUniformCostUnSuccesfulSearch.
@Test
public void testUniformCostUnSuccesfulSearch() throws Exception {
Problem<NQueensBoard, QueenAction> problem = new GeneralProblem<>(new NQueensBoard(3), NQueensFunctions::getIFActions, NQueensFunctions::getResult, NQueensFunctions::testGoal);
SearchForActions<NQueensBoard, QueenAction> search = new UniformCostSearch<>();
SearchAgent<NQueensBoard, QueenAction> agent = new SearchAgent<>(problem, search);
List<Action> actions = agent.getActions();
Assert.assertEquals(0, actions.size());
Assert.assertEquals("6", agent.getInstrumentation().getProperty("nodesExpanded"));
// Will be 0 as did not reach goal state.
Assert.assertEquals("0", agent.getInstrumentation().getProperty("pathCost"));
}
Aggregations