private String Lab6BinaryGA(IEvaluation <bool> evaluation, ASelection selection, ACrossover crossover, double pMut, int popSize, Dictionary <String, int> problemStallCounter, int?seed) { IterationsStopCondition stopCondition = new IterationsStopCondition(evaluation.dMaxValue, 100); BinaryRandomGenerator generator = new BinaryRandomGenerator(evaluation.pcConstraint, seed); BinaryBitFlipMutation mutation = new BinaryBitFlipMutation(pMut, evaluation, seed); GAStallDetection <bool> ga = new GAStallDetection <bool>(evaluation, stopCondition, generator, selection, crossover, mutation, popSize, 20); ga.Run(); //Console.WriteLine(evaluation.GetType().Name + " : " + ga.countStalling); DictionaryCounterUpdate(problemStallCounter, evaluation.GetType().Name, ga.countStalling); //ReportOptimizationResult(ga.Result); return(FormatSave(ga)); }
private String Lab6BinaryIslandModel(IEvaluation <bool> evaluation, ASelection selection, ACrossover crossover, double pMut, int popSize, int islandCount, PopulationChoosingMethod method, int maxNCD, int?seed) { IterationsStopCondition stopCondition = new IterationsStopCondition(evaluation.dMaxValue, 100); BinaryRandomGenerator generator = new BinaryRandomGenerator(evaluation.pcConstraint, seed); BinaryBitFlipMutation mutation = new BinaryBitFlipMutation(pMut, evaluation, seed); APopulationCrossover <bool> populationCrossover = new ParametrizedPopulationCrossover <bool>(crossover, .5, method); IslandModel im = new IslandModel(evaluation, stopCondition, generator, selection, crossover, mutation, popSize, islandCount, maxNCD, populationCrossover); GAStallDetection <bool> ga = new GAStallDetection <bool>(evaluation, stopCondition, generator, selection, crossover, mutation, 20, 5); ga.Run(); ReportOptimizationResult(ga.Result); return(FormatSave(ga)); }