Examples of UniformCostSearch


Examples of aima.core.search.uninformed.UniformCostSearch

      break;
    case ID_SEARCH:
      result = new IterativeDeepeningSearch();
      break;
    case UC_SEARCH:
      result = new UniformCostSearch(qs);
      break;
    case GBF_SEARCH:
      result = new GreedyBestFirstSearch(qs, hf);
      break;
    case ASTAR_SEARCH:
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

  public void testUniformCostSuccesfulSearch() throws Exception {
    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());
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

  public void testUniformCostUnSuccesfulSearch() throws Exception {
    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());
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

        MapFunctionFactory.getActionsFunction(romaniaMap),
        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",
        search.getMetrics().get(QueueSearch.METRIC_PATH_COST));
  }
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

    Problem problem = new Problem("start",
        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",
        search.getMetrics().get(QueueSearch.METRIC_PATH_COST));
  }
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

    aMap.addBidirectionalLink("B", "C", 4.0);
    aMap.addBidirectionalLink("C", "D", 7.0);
    aMap.addUnidirectionalLink("B", "E", 14.0);

    me = new MapEnvironment(aMap);
    ma = new MapAgent(me.getMap(), me, new UniformCostSearch(),
        new String[] { "A" });
  }
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

    Assert.assertEquals(p.getAttribute(DynAttributeNames.PERCEPT_IN), "D");
  }

  @Test
  public void testTwoAgentsSupported() {
    MapAgent ma1 = new MapAgent(me.getMap(), me, new UniformCostSearch(),
        new String[] { "A" });
    MapAgent ma2 = new MapAgent(me.getMap(), me, new UniformCostSearch(),
        new String[] { "A" });

    me.addAgent(ma1, "A");
    me.addAgent(ma2, "A");
    me.executeAction(ma1, new MoveToAction("B"));
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

  }

  @Test
  public void testAlreadyAtGoal() {
    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, new UniformCostSearch(),
        new String[] { "A" });
    me.addAgent(ma, "A");
    me.addEnvironmentView(new TestEnvironmentView());
    me.stepUntilDone();
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

  }

  @Test
  public void testNormalSearch() {
    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, new UniformCostSearch(),
        new String[] { "D" });
    me.addAgent(ma, "A");
    me.addEnvironmentView(new TestEnvironmentView());
    me.stepUntilDone();
View Full Code Here

Examples of aima.core.search.uninformed.UniformCostSearch

  }

  @Test
  public void testNoPath() {
    MapEnvironment me = new MapEnvironment(aMap);
    MapAgent ma = new MapAgent(me.getMap(), me, new UniformCostSearch(),
        new String[] { "A" });
    me.addAgent(ma, "E");
    me.addEnvironmentView(new TestEnvironmentView());
    me.stepUntilDone();
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.