コード例 #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(PermutationCrossover crossoverOptions, double weight = 1)
        {
            var crossovers = GeneticFactory.ConstructPermutationCrossoverOperators(crossoverOptions, weight);

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

            _crossoverF += ComputeWeightedSum(crossovers);
        }
コード例 #2
0
 /// <summary>
 /// Gets the default crossover operators.
 /// </summary>
 /// <returns>The default crossover operators.</returns>
 protected override List <ICrossover> GetDefaultCrossovers()
 {
     return(GeneticFactory.ConstructPermutationCrossoverOperators(DEFAULT_CROSSOVER_OPTIONS));
 }
コード例 #3
0
        private PermutationChromosome GetCrossover(PermutationChromosome x, PermutationChromosome y, PermutationCrossover crossover)
        {
            var rator = GeneticFactory.ConstructPermutationCrossoverOperators(crossover).First();

            return(rator.Invoke(x, y) as PermutationChromosome);
        }