Beispiel #1
0
  private void TSPHillClimbingSearch(ProbTSPBoard TSPB, java.awt.TextArea a) {
    // System.out.println("\nTSP HillClimbing  -->");
    try {
      Problem problem =
          new Problem(
              TSPB,
              new ProbTSPSuccessorFunction(),
              new ProbTSPGoalTest(),
              new ProbTSPHeuristicFunction());
      Search search = new HillClimbingSearch();
      SearchAgent agent = new SearchAgent(problem, search);

      // System.out.println();
      printActions(agent.getActions(), a);
      // printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #2
0
  private void TSPSimulatedAnnealingSearch(ProbTSPBoard TSPB, java.awt.TextArea a) {
    // System.out.println("\nTSP Simulated Annealing  -->");
    try {
      Problem problem =
          new Problem(
              TSPB,
              new ProbTSPSuccessorFunctionSA(),
              new ProbTSPGoalTest(),
              new ProbTSPHeuristicFunction());
      SimulatedAnnealingSearch search =
          new SimulatedAnnealingSearch(
              NiterS.getValue(),
              1000,
              ParKS.getValue(),
              numForm.parse(LambdaFT.getText()).doubleValue());
      // search.traceOn();
      SearchAgent agent = new SearchAgent(problem, search);

      printActions(agent.getActions(), a);
      // printInstrumentation(agent.getInstrumentation());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }