Package aima.core.search.informed

Examples of aima.core.search.informed.AStarSearch


      break;
    case GBF_SEARCH:
      result = new GreedyBestFirstSearch(qs, hf);
      break;
    case ASTAR_SEARCH:
      result = new AStarSearch(qs, hf);
      break;
    case RBF_SEARCH:
      result = new RecursiveBestFirstSearch(new AStarEvaluationFunction(
          hf));
      break;
View Full Code Here


        .println("\nEightPuzzleDemo AStar Search (MisplacedTileHeursitic)-->");
    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) {
View Full Code Here

        .println("\nEightPuzzleDemo AStar Search (ManhattanHeursitic)-->");
    try {
      Problem problem = new Problem(random1, EightPuzzleFunctionFactory
          .getActionsFunction(), EightPuzzleFunctionFactory
          .getResultFunction(), new EightPuzzleGoalTest());
      Search search = new AStarSearch(new GraphSearch(),
          new ManhattanHeuristicFunction());
      SearchAgent agent = new SearchAgent(problem, search);
      printActions(agent.getActions());
      printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
View Full Code Here

            .get(i)), wayFilter);
        HeuristicFunction hf = createHeuristicFunction(toRNode,
            waySelection);
        Problem problem = createProblem(fromRNode, toRNode, mapData,
            wayFilter, ignoreOneways, waySelection);
        Search search = new AStarSearch(new GraphSearch(), hf);
        List<Action> actions = search.search(problem);
        if (actions.isEmpty())
          break;
        for (Object action : actions) {
          if (action instanceof OsmMoveAction) {
            OsmMoveAction a = (OsmMoveAction) action;
View Full Code Here

      Problem problem = new Problem(board,
          EightPuzzleFunctionFactory.getActionsFunction(),
          EightPuzzleFunctionFactory.getResultFunction(),
          new EightPuzzleGoalTest());
      Search search = new AStarSearch(new GraphSearch(),
          new ManhattanHeuristicFunction());
      SearchAgent agent = new SearchAgent(problem, search);
      Assert.assertEquals(23, agent.getActions().size());
      Assert.assertEquals("926",
          agent.getInstrumentation().getProperty("nodesExpanded"));
View Full Code Here

        MapFunctionFactory.getActionsFunction(romaniaMap),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST),
        new MapStepCostFunction(romaniaMap));

    Search search = new AStarSearch(new GraphSearch(),
        new StraightLineDistanceHeuristicFunction(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST, romaniaMap));
    SearchAgent agent = new SearchAgent(problem, search);

    List<Action> actions = agent.getActions();

    Assert.assertEquals(
        "[Action[name==moveTo, location==RimnicuVilcea], Action[name==moveTo, location==Pitesti], Action[name==moveTo, location==Bucharest]]",
        actions.toString());
    Assert.assertEquals("278.0",
        search.getMetrics().get(QueueSearch.METRIC_PATH_COST));
  }
View Full Code Here

        MapFunctionFactory.getActionsFunction(romaniaMap),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST),
        new MapStepCostFunction(romaniaMap));

    Search search = new AStarSearch(new TreeSearch(),
        new StraightLineDistanceHeuristicFunction(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST, romaniaMap));
    SearchAgent agent = new SearchAgent(problem, search);
    Assert.assertEquals(
        "[Action[name==moveTo, location==Sibiu], Action[name==moveTo, location==RimnicuVilcea], Action[name==moveTo, location==Pitesti], Action[name==moveTo, location==Bucharest]]",
View Full Code Here

        MapFunctionFactory.getActionsFunction(romaniaMap),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST),
        new MapStepCostFunction(romaniaMap));

    Search search = new AStarSearch(new GraphSearch(),
        new StraightLineDistanceHeuristicFunction(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST, romaniaMap));
    SearchAgent agent = new SearchAgent(problem, search);
    Assert.assertEquals(
        "[Action[name==moveTo, location==Sibiu], Action[name==moveTo, location==RimnicuVilcea], Action[name==moveTo, location==Pitesti], Action[name==moveTo, location==Bucharest]]",
View Full Code Here

    HeuristicFunction hf = new HeuristicFunction() {
      public double h(Object state) {
        return 0; // Don't have one for this test
      }
    };
    Search search = new AStarSearch(new GraphSearch(), hf);
    SearchAgent agent = new SearchAgent(problem, search);

    List<Action> actions = agent.getActions();

    Assert.assertEquals(
        "[Action[name==moveTo, location==b], Action[name==moveTo, location==d], Action[name==moveTo, location==goal]]",
        actions.toString());
    Assert.assertEquals("5.5",
        search.getMetrics().get(QueueSearch.METRIC_PATH_COST));
  }
View Full Code Here

TOP

Related Classes of aima.core.search.informed.AStarSearch

Copyright © 2018 www.massapicom. 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.