Example #1
0
        public static void Run(CostFunction f, int max_iteration = 500)
        {
            ConjugateGradientSearch s = new ConjugateGradientSearch();

            double[] x_0 = f.CreateRandomSolution();

            s.SolutionUpdated += (best_solution, step) =>
            {
                Console.WriteLine("Step {0}: Fitness = {1}", step, best_solution.Cost);
            };

            s.Minimize(x_0, f, max_iteration);
        }
Example #2
0
        public DifferentialEvolution(CostFunction f)
        {
            mSolutionGenerator = (dimension, constraints) =>
            {
                double[] x_0 = f.CreateRandomSolution();
                return(x_0);
            };

            mPopSize   = f.DimensionCount * 10;
            mDimension = f.DimensionCount;

            mUpperBounds = f.UpperBounds;
            mLowerBounds = f.LowerBounds;
        }
        public static void Run(CostFunction f, int max_iterations = 200)
        {
            SLOP s = new SLOP();


            double[] x_0 = f.CreateRandomSolution();

            s.SolutionUpdated += (best_solution, step) =>
            {
                Console.WriteLine("Step {0}: Fitness = {1}", step, best_solution.Cost);
            };

            s.Minimize(x_0, f, max_iterations);
        }
Example #4
0
        public EvolutionaryProgramming(CostFunction f, int popSize = 100, int boutSize = 5)
        {
            mSolutionGenerator = (dimension, constraints) =>
            {
                double[] x_0 = f.CreateRandomSolution();
                return(x_0);
            };

            mPopSize   = popSize;
            mDimension = f.DimensionCount;
            mBoutSize  = boutSize;

            mUpperBounds = f.UpperBounds;
            mLowerBounds = f.LowerBounds;
        }
        public EvolutionStrategy(CostFunction f, int mu = 30, int lambda = 20)
        {
            mSolutionGenerator = (dimension, constraints) =>
            {
                double[] x_0 = f.CreateRandomSolution();
                return(x_0);
            };

            mPopSize_mu           = mu;
            mOffspringSize_lambda = lambda;
            mDimension            = f.DimensionCount;

            mUpperBounds = f.UpperBounds;
            mLowerBounds = f.LowerBounds;
        }