static void Main(string[] args) { TSPFileLoader fileLoader = new TSPFileLoader(); fileLoader.LoadAndListTSPFiles(); TSPProblem problem = fileLoader.SelectAndLoadFile(); //problem.PrintDistanceMatrix(); Console.WriteLine("\nRandom Algorithm"); Algorithm randomAlgorithm = new RandomAlgorithm(problem); randomAlgorithm.PerformAlgorithm(); printAlgorithmResults(randomAlgorithm); Console.WriteLine("\nGreedy Algorithm"); Algorithm greedyAlgorithm = new GreedyAlgorithm(problem); greedyAlgorithm.PerformAlgorithm(); printAlgorithmResults(greedyAlgorithm); GeneticAlgorithmParameters parameters = readParameters(); Algorithm geneticAlgorithm = new GeneticAlgorithm(problem) { Parameters = parameters, Selection = new TournamentSelection(), Crossover = new OrderedCrossover(), Mutation = new InversionMutation() }; geneticAlgorithm.PerformAlgorithm(); printAlgorithmResults(geneticAlgorithm); }
public GeneticAlgorithmInstance(TSPProblem problem, ISelection selection, ICrossover crossover, IMutation mutation) { this.problem = problem; this.selection = selection; this.crossover = crossover; this.mutation = mutation; randomGenerator = new Random(); }
public GreedyAlgorithm(TSPProblem problem) : base(problem) { }
public Algorithm(TSPProblem problem) { this.Problem = problem; }
public RandomAlgorithm(TSPProblem problem) : base(problem) { }
public GeneticAlgorithm(TSPProblem problem) : base(problem) { }