Package aima.core.search.framework

Examples of aima.core.search.framework.Problem


        agent.getInstrumentation().getProperty("pathCost"));
  }

  @Test
  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);
View Full Code Here


  }

  @Test
  public void testAIMA3eFigure3_15() throws Exception {
    Map romaniaMap = new SimplifiedRoadMapOfPartOfRomania();
    Problem problem = new Problem(SimplifiedRoadMapOfPartOfRomania.SIBIU,
        MapFunctionFactory.getActionsFunction(romaniaMap),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST),
        new MapStepCostFunction(romaniaMap));
View Full Code Here

    map.addBidirectionalLink("b", "d", 2.0);
    map.addBidirectionalLink("c", "d", 4.0);
    map.addBidirectionalLink("c", "e", 1.0);
    map.addBidirectionalLink("d", "goal", 1.0);
    map.addBidirectionalLink("e", "goal", 5.0);
    Problem problem = new Problem("start",
        MapFunctionFactory.getActionsFunction(map),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            "goal"), new MapStepCostFunction(map));

    Search search = new UniformCostSearch();
View Full Code Here

          && !CancelableThread.currIsCanceled(); i++) {
        MapNode toRNode = mapData.getNearestWayNode(new Position(locs
            .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;
View Full Code Here

public class SolutionCheckerTest {

  @Test
  public void testMultiGoalProblem() throws Exception {
    Map romaniaMap = new SimplifiedRoadMapOfPartOfRomania();
    Problem problem = new Problem(SimplifiedRoadMapOfPartOfRomania.ARAD,
        MapFunctionFactory.getActionsFunction(romaniaMap),
        MapFunctionFactory.getResultFunction(), new DualMapGoalTest(
            SimplifiedRoadMapOfPartOfRomania.BUCHAREST,
            SimplifiedRoadMapOfPartOfRomania.HIRSOVA),
        new MapStepCostFunction(romaniaMap));
View Full Code Here

      switch (state.getValue(MapAgentFrame.AGENT_SEL)) {
      case 0:
        agent = new SDMapAgent(env, search, new String[] { locs[1] });
        break;
      case 1:
        Problem p = new BidirectionalMapProblem(map, null, locs[1]);
        OnlineSearchProblem osp = new OnlineSearchProblem
        (p.getActionsFunction(), p.getGoalTest(), p.getStepCostFunction());
        agent = new LRTAStarAgent
        (osp, MapFunctionFactory.getPerceptToStateFunction(), heuristic);
        break;
      }
      env.addAgent(agent, locs[0]);
View Full Code Here

   
    @Override
    protected Problem formulateProblem(Object goal) {
      BidirectionalMapProblem problem =
        (BidirectionalMapProblem) super.formulateProblem(goal);
      Problem result = new Problem(
          problem.getInitialState(),
          problem.getActionsFunction(),
          problem.getResultFunction(),
          new DefaultGoalTest((String) goal) {
            @Override
View Full Code Here

public class BreadthFirstSearchTest {

  @Test
  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);
View Full Code Here

        agent.getInstrumentation().getProperty("pathCost"));
  }

  @Test
  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);
View Full Code Here

public class DepthFirstSearchTest {

  @Test
  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);
View Full Code Here

TOP

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

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.