Package aima.core.search.framework

Examples of aima.core.search.framework.Problem


        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            goalState), new MapStepCostFunction(map));

    this.map = map;

    reverseProblem = new Problem(goalState,
        MapFunctionFactory.getActionsFunction(map),
        MapFunctionFactory.getResultFunction(), new DefaultGoalTest(
            initialState), new MapStepCostFunction(map));
  }
View Full Code Here


    searchOutcome = SearchOutcome.PATH_NOT_FOUND;

    clearInstrumentation();

    Problem op = ((BidirectionalProblem) p).getOriginalProblem();
    Problem rp = ((BidirectionalProblem) p).getReverseProblem();

    CachedStateQueue<Node> opFrontier = new CachedStateQueue<Node>();
    CachedStateQueue<Node> rpFrontier = new CachedStateQueue<Node>();

    GraphSearch ogs = new GraphSearch();
    GraphSearch rgs = new GraphSearch();
    // Ensure the instrumentation for these
    // are cleared down as their values
    // are used in calculating the overall
    // bidirectional metrics.
    ogs.clearInstrumentation();
    rgs.clearInstrumentation();

    Node opNode = new Node(op.getInitialState());
    Node rpNode = new Node(rp.getInitialState());
    opFrontier.insert(opNode);
    rpFrontier.insert(rpNode);

    setQueueSize(opFrontier.size() + rpFrontier.size());
    setNodesExpanded(ogs.getNodesExpanded() + rgs.getNodesExpanded());
View Full Code Here

     */
    protected void addAgent() throws Exception {
      if (agent == null) {
        int pSel = frame.getSelection().getValue(
            EightPuzzleFrame.SEARCH_SEL);
        Problem problem = new Problem(env.getBoard(),
            EightPuzzleFunctionFactory.getActionsFunction(),
            EightPuzzleFunctionFactory.getResultFunction(),
            new EightPuzzleGoalTest());
        Search search = SEARCH_ALGOS.get(pSel);
        agent = new SearchAgent(problem, search);
View Full Code Here

        ActionsFunction af;
        if (pSel == 0)
          af = NQueensFunctionFactory.getIActionsFunction();
        else
          af = NQueensFunctionFactory.getCActionsFunction();
        Problem problem = new Problem(env.getBoard(), af,
            NQueensFunctionFactory.getResultFunction(),
            new NQueensGoalTest());
        Search search = SEARCH_ALGOS.get(sSel);
        agent = new SearchAgent(problem, search);
        env.addAgent(agent);
View Full Code Here

    switch (state.getValue(MapAgentFrame.AGENT_SEL)) {
    case 0:
      agent = new MapAgent(map, 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

  }

  private static void nQueensWithRecursiveDLS() {
    System.out.println("\nNQueensDemo recursive DLS -->");
    try {
      Problem problem = new Problem(new NQueensBoard(8),
          NQueensFunctionFactory.getIActionsFunction(),
          NQueensFunctionFactory.getResultFunction(),
          new NQueensGoalTest());
      Search search = new DepthLimitedSearch(8);
      SearchAgent agent = new SearchAgent(problem, search);
View Full Code Here

  }

  private static void nQueensWithBreadthFirstSearch() {
    try {
      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);
View Full Code Here

  }

  private static void nQueensWithDepthFirstSearch() {
    System.out.println("\nNQueensDemo DFS -->");
    try {
      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

  }

  private static void nQueensWithIterativeDeepeningSearch() {
    System.out.println("\nNQueensDemo Iterative DS  -->");
    try {
      Problem problem = new Problem(new NQueensBoard(8),
          NQueensFunctionFactory.getIActionsFunction(),
          NQueensFunctionFactory.getResultFunction(),
          new NQueensGoalTest());
      Search search = new IterativeDeepeningSearch();
      SearchAgent agent = new SearchAgent(problem, search);
View Full Code Here

  }

  private static void nQueensSimulatedAnnealingSearch() {
    System.out.println("\nNQueensDemo Simulated Annealing  -->");
    try {
      Problem problem = new Problem(new NQueensBoard(8),
          NQueensFunctionFactory.getIActionsFunction(),
          NQueensFunctionFactory.getResultFunction(),
          new NQueensGoalTest());
      SimulatedAnnealingSearch search = new SimulatedAnnealingSearch(
          new AttackingPairsHeuristic());
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.