Example #1
0
 public static List<Point> parseToPoints(String data) {
   List<Point> points = new ArrayList<>();
   for (String line : data.split(System.lineSeparator())) {
     points.add(new Point(line));
   }
   return points;
 }
Example #2
0
 private static List<Algorithm> firstLab() {
   List<Algorithm> algorithms = new ArrayList<>();
   algorithms.add(new GreedyCycle());
   algorithms.add(new NearestNeighbour());
   algorithms.add(
       new StandardAlgorithm(null, new Grasp(), new IterationStopCondition(MAX_ITERATIONS)));
   return algorithms;
 }
Example #3
0
 private static List<Algorithm> secondLab() {
   List<Algorithm> algorithms = new ArrayList<>();
   algorithms.add(
       new StandardAlgorithm(
           new GreedyLocalSearch(new EdgeSwap(), new StandardMovesGenerator()),
           new Grasp(),
           new IterationStopCondition(MAX_ITERATIONS)));
   algorithms.add(
       new StandardAlgorithm(
           new StromyLocalSearch(new EdgeSwap(), new StandardMovesGenerator()),
           new Grasp(),
           new IterationStopCondition(MAX_ITERATIONS)));
   return algorithms;
 }
Example #4
0
 private static List<Algorithm> thirdLab(long timeLimit) {
   List<Algorithm> algorithms = new ArrayList<>();
   StandardMovesGenerator standardMovesGenerator = new StandardMovesGenerator();
   EdgeSwap swapType = new EdgeSwap();
   CandidateMovesGenerator candidateMovesGenerator = new CandidateMovesGenerator();
   Grasp solutionConstructor = new Grasp();
   StopCondition timeStopCondition = new TimeStopCondition(timeLimit);
   //        algorithms.add(new StandardAlgorithm(new StromyLocalSearch(swapType,
   // candidateMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new StandardAlgorithm(new StromyLocalSearch(swapType,
   // standardMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new StandardAlgorithm(new GreedyLocalSearch(swapType,
   // candidateMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new StandardAlgorithm(new GreedyLocalSearch(swapType,
   // standardMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new MultipleStartAlgorithm(new StromyLocalSearch(swapType,
   // candidateMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new MultipleStartAlgorithm(new GreedyLocalSearch(swapType,
   // candidateMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new IterationSearchAlgorithm(new StromyLocalSearch(swapType,
   // candidateMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   //        algorithms.add(new IterationSearchAlgorithm(new GreedyLocalSearch(swapType,
   // candidateMovesGenerator), solutionConstructor, timeStopCondition,MAX_REPEATS));
   algorithms.add(
       new MultipleStartAlgorithm(
           new StromyLocalSearch(swapType, standardMovesGenerator),
           solutionConstructor,
           timeStopCondition,
           MAX_REPEATS));
   algorithms.add(
       new IterationSearchAlgorithm(
           new StromyLocalSearch(swapType, standardMovesGenerator),
           solutionConstructor,
           timeStopCondition,
           MAX_REPEATS));
   algorithms.add(
       new MultipleStartAlgorithm(
           new GreedyLocalSearch(swapType, standardMovesGenerator),
           solutionConstructor,
           timeStopCondition,
           MAX_REPEATS));
   algorithms.add(
       new IterationSearchAlgorithm(
           new GreedyLocalSearch(swapType, standardMovesGenerator),
           solutionConstructor,
           timeStopCondition,
           MAX_REPEATS));
   return algorithms;
 }
Example #5
0
 private static List<Algorithm> forthLab(long timeLimit) {
   List<Algorithm> algorithms = new ArrayList<>();
   algorithms.add(
       new EvolutionAlgorithm(
           new StromyLocalSearch(new EdgeSwap(), new StandardMovesGenerator()),
           new Grasp(),
           new TimeStopCondition(timeLimit),
           new RandomChildCreator(),
           new DefaultPopulationCollector()));
   algorithms.add(
       new EvolutionAlgorithm(
           new StromyLocalSearch(new EdgeSwap(), new StandardMovesGenerator()),
           new Grasp(),
           new TimeStopCondition(timeLimit),
           new ParentChildCreator(),
           new DistinctPopulationCollector()));
   return algorithms;
 }