Package aima.core.search.framework

Examples of aima.core.search.framework.SearchAgent


          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


          EightPuzzleFunctionFactory.getActionsFunction(),
          EightPuzzleFunctionFactory.getResultFunction(),
          new EightPuzzleGoalTest());
      Search search = new GreedyBestFirstSearch(new GraphSearch(),
          new ManhattanHeuristicFunction());
      SearchAgent agent = new SearchAgent(problem, search);
      printActions(agent.getActions());
      printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
    }

  }
View Full Code Here

      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

      Problem problem = new Problem(random1, EightPuzzleFunctionFactory
          .getActionsFunction(), EightPuzzleFunctionFactory
          .getResultFunction(), new EightPuzzleGoalTest());
      SimulatedAnnealingSearch search = new SimulatedAnnealingSearch(
          new ManhattanHeuristicFunction());
      SearchAgent agent = new SearchAgent(problem, search);
      printActions(agent.getActions());
      System.out.println("Search Outcome=" + search.getOutcome());
      System.out.println("Final State=\n" + search.getLastSearchState());
      printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      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) {
      e.printStackTrace();
    }

  }
View Full Code Here

    Problem problem = new Problem(new NQueensBoard(8),
        NQueensFunctionFactory.getIActionsFunction(),
        NQueensFunctionFactory.getResultFunction(),
        new NQueensGoalTest());
    Search search = new UniformCostSearch();
    SearchAgent agent = new SearchAgent(problem, search);

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

    Assert.assertEquals(8, actions.size());

    Assert.assertEquals("1965",
        agent.getInstrumentation().getProperty("nodesExpanded"));

    Assert.assertEquals("8.0",
        agent.getInstrumentation().getProperty("pathCost"));
  }
View Full Code Here

    Problem problem = new Problem(new NQueensBoard(3),
        NQueensFunctionFactory.getIActionsFunction(),
        NQueensFunctionFactory.getResultFunction(),
        new NQueensGoalTest());
    Search search = new UniformCostSearch();
    SearchAgent 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"));
  }
View Full Code Here

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

    Search search = new UniformCostSearch();
    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",
View Full Code Here

        MapFunctionFactory.getActionsFunction(map),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            "goal"), new MapStepCostFunction(map));

    Search search = new UniformCostSearch();
    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",
View Full Code Here

            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());
    Assert.assertEquals(5, agent.getActions().size());
    Assert.assertEquals("14",
        agent.getInstrumentation().getProperty("nodesExpanded"));
    Assert.assertEquals("1",
        agent.getInstrumentation().getProperty("queueSize"));
    Assert.assertEquals("5",
        agent.getInstrumentation().getProperty("maxQueueSize"));
  }
View Full Code Here

TOP

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

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.