Package aima.core.search.framework

Examples of aima.core.search.framework.GraphSearch


            .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) {
View Full Code Here


        MapFunctionFactory.getResultFunction(), new DualMapGoalTest(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST,
            SimplifiedRoadMapOfPartOfRomania.HIRSOVA),
        new MapStepCostFunction(romaniaMap));

    Search search = new BreadthFirstSearch(new GraphSearch());

    SearchAgent agent = new SearchAgent(problem, search);
    Assert.assertEquals(
        "[Action[name==moveTo, location==Sibiu], Action[name==moveTo, location==Fagaras], Action[name==moveTo, location==Bucharest], Action[name==moveTo, location==Urziceni], Action[name==moveTo, location==Hirsova]]",
        agent.getActions().toString());
View Full Code Here

  public void testDepthFirstSuccesfulSearch() throws Exception {
    Problem problem = new Problem(new NQueensBoard(8),
        NQueensFunctionFactory.getIActionsFunction(),
        NQueensFunctionFactory.getResultFunction(),
        new NQueensGoalTest());
    Search search = new DepthFirstSearch(new GraphSearch());
    SearchAgent agent = new SearchAgent(problem, search);
    List<Action> actions = agent.getActions();
    assertCorrectPlacement(actions);
    Assert.assertEquals("113",
        agent.getInstrumentation().getProperty("nodesExpanded"));
View Full Code Here

  public void testDepthFirstUnSuccessfulSearch() throws Exception {
    Problem problem = new Problem(new NQueensBoard(3),
        NQueensFunctionFactory.getIActionsFunction(),
        NQueensFunctionFactory.getResultFunction(),
        new NQueensGoalTest());
    Search search = new DepthFirstSearch(new GraphSearch());
    SearchAgent agent = new SearchAgent(problem, search);
    List<Action> actions = agent.getActions();
    Assert.assertEquals(0, actions.size());
    Assert.assertEquals("6",
        agent.getInstrumentation().getProperty("nodesExpanded"));
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();
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(
View Full Code Here

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

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

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

TOP

Related Classes of aima.core.search.framework.GraphSearch

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.