Switch from inheritance to composition

This commit is contained in:
Laurent
2026-10-15 08:54:58 +02:00
parent 0a899a7e09
commit a0f432b476
6 changed files with 74 additions and 42 deletions

View File

@@ -1,5 +1,7 @@
import domain.annealing.SimulatedAnnealing;
import domain.ant_colony.AntColonyOptimization;
import domain.binary.algorithm.AbstractGeneticAlgorithm;
import domain.binary.algorithm.AlgorithmEngine;
import domain.binary.algorithm.CustomGeneticAlgorithm;
import domain.binary.algorithm.SimpleGeneticAlgorithm;
@@ -19,7 +21,7 @@ public class Main {
System.out.println("Optimized distance for travel: " + SimulatedAnnealing.simulateAnnealing(10, 10000, 0.9995));
break;
case 2:
SimpleGeneticAlgorithm ga = new SimpleGeneticAlgorithm(
AbstractGeneticAlgorithm ga = new SimpleGeneticAlgorithm(
15,
0.5,
0.025,
@@ -27,7 +29,7 @@ public class Main {
true,
"1011000100000100010000100000100111001000000100000100000000001111"
);
ga.launch();
AlgorithmEngine.start(ga);
break;
case 3:
AntColonyOptimization antColony = new AntColonyOptimization(21);