Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a list of neural crossovers operators.
        /// </summary>
        /// <param name="crossoverOptions">The neural crossover options.</param>
        /// <param name="weight">The crossover weight.</param>
        /// <returns>The constructed neural crossovers operators.</returns>
        public static List <ICrossover> ConstructNeuralCrossoverOperators(NeuralCrossover crossoverOptions, double weight = 1)
        {
            var crossovers = new List <ICrossover>();

            if ((crossoverOptions & NeuralCrossover.Neat) == NeuralCrossover.Neat)
            {
                crossovers.Add(new NeatCrossover(weight));
            }

            return(crossovers);
        }
        private NeuralChromosome GetCrossover(NeuralChromosome x, NeuralChromosome y, NeuralCrossover crossover)
        {
            var rator = GeneticFactory.ConstructNeuralCrossoverOperators(crossover).First();

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