Example #1
0
        /// <summary>
        /// Crossover this gene with another of the same type.
        /// </summary>
        /// <typeparam name="TGene"></typeparam>
        /// <param name="gene"></param>
        /// <param name="other"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static TGene Crossover <TGene>(this TGene gene, TGene other, GeneticAlgorithmSettings settings)
            where TGene : IGene
        {
            IGene result = gene.Crossover((IGene)other, settings);

            if (result != null && result is TGene)
            {
                return((TGene)result);
            }
            else
            {
                return(default(TGene));
            }
        }
 /// <summary>
 /// Create a new option by breeding this option with another
 /// </summary>
 /// <typeparam name="TOption"></typeparam>
 /// <param name="option"></param>
 /// <param name="with">The other parent</param>
 /// <param name="settings">Genetic Algorithm settings</param>
 /// <returns></returns>
 public static TOption Breed <TOption>(this TOption option, TOption with, GeneticAlgorithmSettings settings)
     where TOption : class, IGeneticAlgorithmPhenotype
 {
     return(option.Breed(with, settings) as TOption);
 }
Example #3
0
 /// <summary>
 /// Initialise the solver
 /// </summary>
 /// <param name="settings"></param>
 public GeneticSolverBase(GeneticAlgorithmSettings settings) : base(settings)
 {
 }