private static void GeneticPeriodicTabuTtp1(Problem.Problem problem, string algorithmSrcFilePath, string outputFilePath, string logOutputType) { var geneticTtp1Params = Loader.Loader.LoadGeneticTtp1Params(algorithmSrcFilePath); if (geneticTtp1Params == null) { Console.WriteLine("Error reading genetic ttp1's configuration src file."); return; } Console.WriteLine("Done reading genetic ttp1's configuration src file."); var tabuTtp1Params = Loader.Loader.LoadTabuTtp1Params(algorithmSrcFilePath); if (tabuTtp1Params == null) { Console.WriteLine("Error reading genetic ttp1's configuration src file."); return; } Console.WriteLine("Done reading genetic ttp1's configuration src file."); var hybridParams = new GeneticPeriodicTabuParameters { GeneticParameters = geneticTtp1Params, TabuParameters = tabuTtp1Params, }; var logger = new Logger.Logger(outputFilePath, logOutputType); try { logger.LogGeneticPeriodicTabuIntro(hybridParams); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.WriteLine("Error writing to the log output file."); return; } var hybrid = new GeneticPeriodicTabu(problem, hybridParams); hybrid.Execute(logger); }
public void LogGeneticPeriodicTabuIntro(GeneticPeriodicTabuParameters parameters) { using (var file = new System.IO.StreamWriter(OutputPath, true)) { file.WriteLine("NUMBER OF ITERATIONS:" + parameters.GeneticParameters.NumAlgorithmIterations); file.WriteLine("POPULATION SIZE:" + parameters.GeneticParameters.PopulationSize); file.WriteLine("NUMBER OF GENERATIONS:" + parameters.GeneticParameters.NumGenerations); file.WriteLine("MUTATION PROBABILITY:" + parameters.GeneticParameters.MutationProbability); file.WriteLine("CROSSING PROBABILITY:" + parameters.GeneticParameters.CrossProbability); file.WriteLine("TOURNAMENT SIZE:" + parameters.GeneticParameters.TournamentSize); file.WriteLine("NEIGHBOURHOOD SIZE:" + parameters.TabuParameters.NeighbourhoodSize); file.WriteLine("NUMBER OF TABU SEARCHES:" + parameters.TabuParameters.NumTabuSearches); file.WriteLine("TABU SIZE:" + parameters.TabuParameters.TabuSize); if (LogOutputType == AlgorithmLogOutput) { file.WriteLine("GENERATION/TABU SEARCH;BEST FITNESS;AVERAGE FITNESS; WORST FITNESS; CURRENT FITNESS"); } } }