private List <String> Lab6StallDetectionMechanism(IEvaluation <bool>[] problems, int seed)
        {
            List <String> results = new List <String>();

            foreach (var problem in problems)
            {
                TournamentSelection selection = new TournamentSelection(5, seed);
                OnePointCrossover   crossover = new OnePointCrossover(.5);
                double pMut    = 0.00000001;
                int    popSize = 20;

                // Hyperparameters
                // Number of islands
                int[] islands = new int[] { 2, 4, 5, 10 };

                // Sposob wyboru populacji do krzyżowania z utkniętą populacją
                PopulationChoosingMethod[] methods = new PopulationChoosingMethod[] {
                    PopulationChoosingMethod.One,
                    PopulationChoosingMethod.Random,
                    PopulationChoosingMethod.Random
                };

                // Sposob wykrycia utknięcia
                int[] maxNCDs = new int[] { 5, 10, 20, 30 };

                // Grid seach po podanych parametrach
                foreach (var n in islands)
                {
                    foreach (var m in methods)
                    {
                        foreach (var mncd in maxNCDs)
                        {
                            results.Add(Lab6BinaryIslandModel(problem, selection, crossover, pMut, popSize,
                                                              n, m, mncd,
                                                              seed));
                        }
                    }
                }
            }
            return(results);
        }
        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));
        }
 public ParametrizedPopulationCrossover(ACrossover crossover, double prob, PopulationChoosingMethod method, int?seed = null)
     : base(crossover, prob, seed)
 {
     Method = method;
 }