Rastrigin benchmark problem.
Inheritance: Benchmark
示例#1
0
        /// <summary>
        /// Create a new instance of a benchmark problem.
        /// </summary>
        /// <param name="id">Benchmark problem ID.</param>
        /// <param name="dimensionality">Dimensionality of problem.</param>
        /// <returns></returns>
        public static Benchmark CreateInstance(this ID id, int dimensionality, int maxIterations)
        {
            Benchmark benchmark;

            switch (id)
            {
            case ID.Ackley:
                benchmark = new Ackley(dimensionality, maxIterations);
                break;

            case ID.Griewank:
                benchmark = new Griewank(dimensionality, maxIterations);
                break;

            case ID.Penalized1:
                benchmark = new Penalized1(dimensionality, maxIterations);
                break;

            case ID.Penalized2:
                benchmark = new Penalized2(dimensionality, maxIterations);
                break;

            case ID.QuarticNoise:
                benchmark = new QuarticNoise(dimensionality, maxIterations);
                break;

            case ID.Rastrigin:
                benchmark = new Rastrigin(dimensionality, maxIterations);
                break;

            case ID.Rosenbrock:
                benchmark = new Rosenbrock(dimensionality, maxIterations);
                break;

            case ID.Schwefel12:
                benchmark = new Schwefel12(dimensionality, maxIterations);
                break;

            case ID.Schwefel221:
                benchmark = new Schwefel221(dimensionality, maxIterations);
                break;

            case ID.Schwefel222:
                benchmark = new Schwefel222(dimensionality, maxIterations);
                break;

            case ID.Sphere:
                benchmark = new Sphere(dimensionality, maxIterations);
                break;

            case ID.Step:
                benchmark = new Step(dimensionality, maxIterations);
                break;

            default:
                throw new ArgumentException();
            }

            return(benchmark);
        }
示例#2
0
        /// <summary>
        /// Create a new instance of a benchmark problem.
        /// </summary>
        /// <param name="id">BenchmarkProblem problem ID.</param>
        /// <param name="dimensionality">Dimensionality of problem.</param>
        /// <returns></returns>
        public static BenchmarkProblem CreateInstance(this ID id, int dimensionality, int maxIterations)
        {
            BenchmarkProblem benchmarkProblem;

            switch (id)
            {
            case ID.Ackley:
                benchmarkProblem = new Ackley(dimensionality, maxIterations);
                break;

            case ID.Griewank:
                benchmarkProblem = new Griewank(dimensionality, maxIterations);
                break;

            case ID.Penalized1:
                benchmarkProblem = new Penalized1(dimensionality, maxIterations);
                break;

            case ID.Penalized2:
                benchmarkProblem = new Penalized2(dimensionality, maxIterations);
                break;

            case ID.QuarticNoise:
                benchmarkProblem = new QuarticNoise(dimensionality, maxIterations);
                break;

            case ID.Rastrigin:
                benchmarkProblem = new Rastrigin(dimensionality, maxIterations);
                break;

            case ID.Rosenbrock:
                benchmarkProblem = new Rosenbrock(dimensionality, maxIterations);
                break;

            case ID.Schwefel12:
                benchmarkProblem = new Schwefel12(dimensionality, maxIterations);
                break;

            case ID.Schwefel221:
                benchmarkProblem = new Schwefel221(dimensionality, maxIterations);
                break;

            case ID.Schwefel222:
                benchmarkProblem = new Schwefel222(dimensionality, maxIterations);
                break;

            case ID.Sphere:
                benchmarkProblem = new Sphere(dimensionality, maxIterations);
                break;

            case ID.Step:
                benchmarkProblem = new Step(dimensionality, maxIterations);
                break;

            // MRC
            case ID.Lim:
                benchmarkProblem = new Lim(dimensionality, maxIterations);
                break;

            case ID.Trid:
                benchmarkProblem = new Trid(dimensionality, maxIterations);
                break;

            case ID.Shubert:
                benchmarkProblem = new Shubert(dimensionality, maxIterations);
                break;

            case ID.Matyas:
                benchmarkProblem = new Matyas(dimensionality, maxIterations);
                break;

            case ID.Branin:
                benchmarkProblem = new Branin(dimensionality, maxIterations);
                break;

            case ID.Franke:
                benchmarkProblem = new Franke(dimensionality, maxIterations);
                break;

            case ID.Grammacy:
                benchmarkProblem = new Grammacy(dimensionality, maxIterations);
                break;

            case ID.OO:
                benchmarkProblem = new OO(dimensionality, maxIterations);
                break;

            case ID.Webster:
                benchmarkProblem = new Webster(dimensionality, maxIterations);
                break;

            case ID.CurrinExponential:
                benchmarkProblem = new CurrinExponential(dimensionality, maxIterations);
                break;

            case ID.Adjiman:
                benchmarkProblem = new Adjiman(dimensionality, maxIterations);
                break;

            case ID.BartelsConn:
                benchmarkProblem = new BartelsConn(dimensionality, maxIterations);
                break;

            case ID.Bird:
                benchmarkProblem = new Bird(dimensionality, maxIterations);
                break;

            case ID.Himmelblau:
                benchmarkProblem = new Himmelblau(dimensionality, maxIterations);
                break;

            case ID.Perm2:
                benchmarkProblem = new Perm2(dimensionality, maxIterations);
                break;

            case ID.Schaffer:
                benchmarkProblem = new Schaffer(dimensionality, maxIterations);
                break;

            case ID.Michaelwicz:
                benchmarkProblem = new Michaelwicz(dimensionality, maxIterations);
                break;

            case ID.Easom:
                benchmarkProblem = new Easom(dimensionality, maxIterations);
                break;

            case ID.SixHumpCamel:
                benchmarkProblem = new SixHumpCamel(dimensionality, maxIterations);
                break;

            case ID.Levy:
                benchmarkProblem = new Levy(dimensionality, maxIterations);
                break;

            case ID.Mccormick:
                benchmarkProblem = new Mccormick(dimensionality, maxIterations);
                break;

            case ID.Levy13:
                benchmarkProblem = new Levy13(dimensionality, maxIterations);
                break;

            case ID.HolderTable:
                benchmarkProblem = new HolderTable(dimensionality, maxIterations);
                break;

            case ID.EggHolder:
                benchmarkProblem = new EggHolder(dimensionality, maxIterations);
                break;

            case ID.DropWave:
                benchmarkProblem = new DropWave(dimensionality, maxIterations);
                break;

            case ID.CrossInTray:
                benchmarkProblem = new CrossInTray(dimensionality, maxIterations);
                break;

            case ID.Bukin:
                benchmarkProblem = new Bukin(dimensionality, maxIterations);
                break;

            case ID.RotatedHyperEllipsoid:
                benchmarkProblem = new RotatedHyperEllipsoid(dimensionality, maxIterations);
                break;

            case ID.SumOfSquares:
                benchmarkProblem = new SumOfSquares(dimensionality, maxIterations);
                break;

            case ID.Beales:
                benchmarkProblem = new Beales(dimensionality, maxIterations);
                break;

            case ID.FitnessTest:
                benchmarkProblem = new FitnessTest(dimensionality, maxIterations);
                break;

            case ID.ManyPeaks:
                benchmarkProblem = new ManyPeaks(dimensionality, maxIterations);
                break;

            case ID.Hole:
                benchmarkProblem = new Hole(dimensionality, maxIterations);
                break;

            case ID.GoldsteinPrice:
                benchmarkProblem = new GoldsteinPrice(dimensionality, maxIterations);
                break;

            case ID.Bumps:
                benchmarkProblem = new Bumps(dimensionality, maxIterations);
                break;

            case ID.Peaks:
                benchmarkProblem = new Peaks(dimensionality, maxIterations);
                break;

            case ID.DoubleDip:
                benchmarkProblem = new DoubleDip(dimensionality, maxIterations);
                break;

            default:
                throw new ArgumentException();
            }

            return(benchmarkProblem);
        }
示例#3
0
        /// <summary>
        /// Create a new instance of a benchmark problem.
        /// </summary>
        /// <param name="id">Benchmark problem ID.</param>
        /// <param name="dimensionality">Dimensionality of problem.</param>
        /// <returns></returns>
        public static Benchmark CreateInstance(this ID id, int dimensionality, int maxIterations)
        {
            Benchmark benchmark;

            switch (id)
            {
                case ID.Ackley:
                    benchmark = new Ackley(dimensionality, maxIterations);
                    break;

                case ID.Griewank:
                    benchmark = new Griewank(dimensionality, maxIterations);
                    break;

                case ID.Penalized1:
                    benchmark = new Penalized1(dimensionality, maxIterations);
                    break;

                case ID.Penalized2:
                    benchmark = new Penalized2(dimensionality, maxIterations);
                    break;

                case ID.QuarticNoise:
                    benchmark = new QuarticNoise(dimensionality, maxIterations);
                    break;

                case ID.Rastrigin:
                    benchmark = new Rastrigin(dimensionality, maxIterations);
                    break;

                case ID.Rosenbrock:
                    benchmark = new Rosenbrock(dimensionality, maxIterations);
                    break;

                case ID.Schwefel12:
                    benchmark = new Schwefel12(dimensionality, maxIterations);
                    break;

                case ID.Schwefel221:
                    benchmark = new Schwefel221(dimensionality, maxIterations);
                    break;

                case ID.Schwefel222:
                    benchmark = new Schwefel222(dimensionality, maxIterations);
                    break;

                case ID.Sphere:
                    benchmark = new Sphere(dimensionality, maxIterations);
                    break;

                case ID.Step:
                    benchmark = new Step(dimensionality, maxIterations);
                    break;

                default:
                    throw new ArgumentException();
            }

            return benchmark;
        }