Examples of BreadthFirstSearch


Examples of aima.core.search.uninformed.BreadthFirstSearch

    switch (strategy) {
    case DF_SEARCH:
      result = new DepthFirstSearch(qs);
      break;
    case BF_SEARCH:
      result = new BreadthFirstSearch(qs);
      break;
    case ID_SEARCH:
      result = new IterativeDeepeningSearch();
      break;
    case UC_SEARCH:
View Full Code Here

Examples of aima.core.search.uninformed.BreadthFirstSearch

      System.out.println("\nNQueensDemo BFS -->");
      Problem problem = new Problem(new NQueensBoard(8),
          NQueensFunctionFactory.getIActionsFunction(),
          NQueensFunctionFactory.getResultFunction(),
          new NQueensGoalTest());
      Search search = new BreadthFirstSearch(new TreeSearch());
      SearchAgent agent2 = new SearchAgent(problem, search);
      printActions(agent2.getActions());
      printInstrumentation(agent2.getInstrumentation());
    } catch (Exception e1) {
View Full Code Here

Examples of aima.core.search.uninformed.BreadthFirstSearch

        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

Examples of aima.core.search.uninformed.BreadthFirstSearch

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

Examples of aima.core.search.uninformed.BreadthFirstSearch

  public void testBreadthFirstUnSuccesfulSearch() throws Exception {
    Problem problem = new Problem(new NQueensBoard(3),
        NQueensFunctionFactory.getIActionsFunction(),
        NQueensFunctionFactory.getResultFunction(),
        new NQueensGoalTest());
    Search search = new BreadthFirstSearch(new TreeSearch());
    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

Examples of org.encog.ml.graph.search.BreadthFirstSearch

    BasicNode nodeB = graph.connect(nodeA,new BasicNode("b"),5);
    BasicNode nodeC = graph.connect(nodeA,new BasicNode("c"),2);
    BasicNode nodeD = graph.connect(nodeB, new BasicNode("d"), 1);
    nodeC.connect(nodeD, 1);
   
    BreadthFirstSearch search = new BreadthFirstSearch(graph,nodeA,new SimpleDestinationGoal(nodeD));
    Assert.assertEquals(4, countIterations(search));
   
    BasicPath solution = search.getSolution();
    Assert.assertEquals(solution.getNodes().get(0).getLabel(), "a");
    Assert.assertEquals(solution.getNodes().get(1).getLabel(), "b");
    Assert.assertEquals(solution.getNodes().get(2).getLabel(), "d");
  }
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.