Examples of MisplacedTilleHeuristicFunction


Examples of aima.core.environment.eightpuzzle.MisplacedTilleHeuristicFunction

      Problem problem = new Problem(boardWithThreeMoveSolution,
          EightPuzzleFunctionFactory.getActionsFunction(),
          EightPuzzleFunctionFactory.getResultFunction(),
          new EightPuzzleGoalTest());
      Search search = new GreedyBestFirstSearch(new GraphSearch(),
          new MisplacedTilleHeuristicFunction());
      SearchAgent agent = new SearchAgent(problem, search);
      printActions(agent.getActions());
      printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of aima.core.environment.eightpuzzle.MisplacedTilleHeuristicFunction

    try {
      Problem problem = new Problem(random1, EightPuzzleFunctionFactory
          .getActionsFunction(), EightPuzzleFunctionFactory
          .getResultFunction(), new EightPuzzleGoalTest());
      Search search = new AStarSearch(new GraphSearch(),
          new MisplacedTilleHeuristicFunction());
      SearchAgent agent = new SearchAgent(problem, search);
      printActions(agent.getActions());
      printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of aima.core.environment.eightpuzzle.MisplacedTilleHeuristicFunction

*/
public class MisplacedTileHeuristicFunctionTest {

  @Test
  public void testHeuristicCalculation() {
    MisplacedTilleHeuristicFunction fn = new MisplacedTilleHeuristicFunction();
    EightPuzzleBoard board = new EightPuzzleBoard(new int[] { 2, 0, 5, 6,
        4, 8, 3, 7, 1 });
    Assert.assertEquals(7.0, fn.h(board), 0.001);

    board = new EightPuzzleBoard(new int[] { 6, 2, 5, 3, 4, 8, 0, 7, 1 });
    Assert.assertEquals(6.0, fn.h(board), 0.001);

    board = new EightPuzzleBoard(new int[] { 6, 2, 5, 3, 4, 8, 7, 0, 1 });
    Assert.assertEquals(7.0, fn.h(board), 0.001);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.