コード例 #1
0
        public ParticleSwarmOptimizationAlgorithm(int dimension, double[] lowerBound, double[] upperBound, IDesignFactory designFactory,
                                                  int swarmSize, double omega, double phip, double phig, IConvergenceCriterion convergenceCriterion, IOptimizationLogger logger,
                                                  Random randomNumberGenerator)
        {
            this.dimension     = dimension;
            this.lowerBound    = lowerBound;
            this.upperBound    = upperBound;
            this.designFactory = designFactory;

            this.swarmSize            = swarmSize;
            this.omega                = omega;
            this.phip                 = phip;
            this.phig                 = phig;
            this.convergenceCriterion = convergenceCriterion;
            this.logger               = logger;

            this.randomNumberGenerator = randomNumberGenerator;
        }
コード例 #2
0
        private GeneticAlgorithm(int continuousVariablesCount, int integerVariablesCount, IDesignFactory designFactory,
                                 IOptimizationLogger logger, IConvergenceCriterion convergenceCriterion, IInitializer <double> initializer,
                                 IEncoding <T> encoding, int populationSize, IPopulationStrategy <T> populationStrategy,
                                 ISelectionStrategy <T> selection, IRecombinationStrategy <T> recombination, IMutationStrategy <T> mutation)
        {
            this.continuousVariablesCount = continuousVariablesCount;
            this.integerVariablesCount    = integerVariablesCount;
            this.designFactory            = designFactory;

            this.logger = logger;
            this.convergenceCriterion = convergenceCriterion;
            this.initializer          = initializer;

            this.encoding           = encoding;
            this.populationSize     = populationSize;
            this.populationStrategy = populationStrategy;
            this.selection          = selection;
            this.recombination      = recombination;
            this.mutation           = mutation;

            this.CurrentIteration = -1; // Initialization phase is not counted towards iterations
            this.BestPosition     = null;
            this.BestFitness      = double.MaxValue;
        }