/// <summary>
        /// Initializes a new instance of the genetic algorithm optimizer.
        /// </summary>
        /// <param name="solutionFitness">A delegate to the fitness function.</param>
        /// <param name="random">An optional Random instance to allow for seeding.
        /// If none is provided, a newly created one is used.</param>
        public GeneticAnnealingAlgorithm(SolutionFitnessFunction solutionFitness, Random random = null)
        {
            // Save the fitness function
            this.solutionFitness = solutionFitness;

            if (random == null) this.random = new Random();
            else this.random = random;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the genetic algorithm optimizer.
        /// </summary>
        /// <param name="solutionFitness">A delegate to the fitness function.</param>
        /// <param name="random">An optional Random instance to allow for seeding.
        /// If none is provided, a newly created one is used.</param>
        public GeneticAnnealingAlgorithm(SolutionFitnessFunction solutionFitness, Random random = null)
        {
            // Save the fitness function
            this.solutionFitness = solutionFitness;

            if (random == null)
            {
                this.random = new Random();
            }
            else
            {
                this.random = random;
            }
        }
 /// <summary>
 /// Initializes a new instance of the genetic algorithm optimizer.
 /// </summary>
 /// <param name="solutionFitness">A delegate to the fitness function.
 /// Because of parallelization the fitness function must be thread safe</param>
 public GeneticAlgorithm(SolutionFitnessFunction solutionFitness)
 {
     // Save the fitness function
     _solutionFitness = solutionFitness;
 }
        /// <summary>
        /// Initializes a new instance of the genetic algorithm optimizer.
        /// </summary>
        /// <param name="solutionFitness">A delegate to the fitness function.
        /// Because of parallelization the fitness function must be thread safe</param>
#pragma warning disable CS8618 // Initialized in InitializeEvolution
        public GeneticAlgorithm(SolutionFitnessFunction solutionFitness)
#pragma warning restore
        {
            // Save the fitness function
            _solutionFitness = solutionFitness;
        }
 /// <summary>
 /// Initializes a new instance of the genetic algorithm optimizer.
 /// </summary>
 /// <param name="solutionFitness">A delegate to the fitness function.
 /// Because of parallelization the fitness function must be thread safe</param>
 public GeneticAlgorithm(SolutionFitnessFunction solutionFitness)
 {
     // Save the fitness function
     _solutionFitness = solutionFitness;
 }