public GeneticTests() { _TSPFileReader = new TSPFileReader(); _ATSPFileReader = new ATSPFileReader(); _TSPParser = new SymmetricalParser(); _ATSPParser = new AsymmetricalParser(); _algorithm = new GeneticAlgorithm(); GetFileNames(); _tspResults = new Dictionary <string, Tuple <float, double> >(); _atspResults = new Dictionary <string, Tuple <float, double> >(); }
private static bool RunGeneticAlgorithm <T>(AbstractGeneticAlgorithm <T> algo, bool verbose = true, GeneticAlgorithmParameters param = null) where T : IChromosome { bool interrupted = false; if (verbose) { param = GetParamGA(out interrupted); if (interrupted) { return(false); } //param = new RecuitSimuleParameters(qap.N); Console.WriteLine("Tout les paramètres sont entrées, commencer l'exécution ? ( o/n, y/n )"); Console.WriteLine(param.ToString()); string str = ""; if (!GetCorrectString(out str, (s) => IsValidation(s))) { return(false); } if (!IsYes(str)) { return(false); } } //Lancer l'exécution algo.Verbose = true; algo.WithLogs = true; bestFitness = algo.Run(param).Fitness; Console.WriteLine("Paramètres :"); Console.WriteLine(param.ToString()); Console.WriteLine("Résultats :"); Console.WriteLine(algo.Logs.FinalLog.ToString()); paramString = param.ToString(); resultString = algo.Logs.FinalLog.ToString(); //Save Results SaveResults(); Console.WriteLine("Résultats sauvegardées dans " + GetResultPath() + "!"); //Save Logs algo.Logs.SaveLogsTo(GetCSVPath()); Console.WriteLine("Logs sauvegardées dans " + GetCSVPath() + "!\n"); if (verbose) { Console.WriteLine("\nAppuyez sur une touche pour revenir au menu."); Console.ReadKey(); Console.WriteLine(); } return(true); }