Exemple #1
0
        protected override IEvaluation <double>[] GenerateProblems()
        {
            int[] genes     = { 2, 5, 10, 25, 50, 75 };
            int   nProblems = genes.Length * 6;

            IEvaluation <double>[] problems = new IEvaluation <double> [nProblems];

            int iterator = 0;

            //Sphere
            foreach (var gene in genes)
            {
                problems[iterator] = new CRealSphereEvaluation(gene);
                iterator++;
            }

            //Sphere-10
            foreach (var gene in genes)
            {
                problems[iterator] = new CRealSphere10Evaluation(gene);
                iterator++;
            }

            //Ellipsoid
            foreach (var gene in genes)
            {
                problems[iterator] = new CRealEllipsoidEvaluation(gene);
                iterator++;
            }

            //Step-2 Sphere
            foreach (var gene in genes)
            {
                problems[iterator] = new CRealStep2SphereEvaluation(gene);
                iterator++;
            }

            //Te problemy będą przydatne do 3 laborek

            //Rastrigin
            foreach (var gene in genes)
            {
                problems[iterator] = new CRealRastriginEvaluation(gene);
                iterator++;
            }

            //Ackley
            foreach (var gene in genes)
            {
                problems[iterator] = new CRealAckleyEvaluation(gene);
                iterator++;
            }

            return(problems);
        }
Exemple #2
0
        private static void Lab2Ellipsoid(int?seed, int variables)
        {
            CRealEllipsoidEvaluation ellipsoidEvaluation = new CRealEllipsoidEvaluation(variables);

            List <double> sigmas = Enumerable.Repeat(0.1, ellipsoidEvaluation.iSize).ToList();

            IterationsStopCondition            stopCondition      = new IterationsStopCondition(ellipsoidEvaluation.dMaxValue, 1000);
            RealGaussianMutation               mutation           = new RealGaussianMutation(sigmas, ellipsoidEvaluation, seed);
            RealNullRealMutationES11Adaptation mutationAdaptation = new RealNullRealMutationES11Adaptation(mutation);

            RealEvolutionStrategy11 es11 = new RealEvolutionStrategy11(ellipsoidEvaluation, stopCondition, mutationAdaptation, seed);

            es11.Run();

            ReportOptimizationResult(es11.Result);
        }