Example #1
0
        /// <summary>
        /// Adds new crossover operators to the metadata.
        /// </summary>
        /// <param name="crossoverOptions">The crossover options.</param>
        /// <param name="weight">The operator weight.</param>
        internal override void AddCrossoverOperators(BinaryCrossover crossoverOptions, double weight = 1)
        {
            var crossovers = GeneticFactory.ConstructBinaryCrossoverOperators(crossoverOptions, weight);

            if (_crossovers == null)
            {
                _crossovers = crossovers;
            }
            else
            {
                _crossovers.AddRange(crossovers);
            }

            _crossoverF += ComputeWeightedSum(crossovers);
        }
Example #2
0
        private BinaryChromosome GetCrossover(BinaryChromosome x, BinaryChromosome y, BinaryCrossover crossover)
        {
            var rator = GeneticFactory.ConstructBinaryCrossoverOperators(crossover).First();

            return(rator.Invoke(x, y) as BinaryChromosome);
        }
Example #3
0
 /// <summary>
 /// Gets the default crossover operators.
 /// </summary>
 /// <returns>The default crossover operators.</returns>
 protected override List <ICrossover> GetDefaultCrossovers()
 {
     return(GeneticFactory.ConstructBinaryCrossoverOperators(DEFAULT_CROSSOVER_OPTIONS));
 }