示例#1
0
 /// <summary>
 /// Initializes a new instance of the GeneticAlgorithm class.
 /// </summary>
 /// <param name="chromosomes">The number of chromosomes in the population.</param>
 /// <param name="generations">The number of generations to run.</param>
 /// <param name="chromosomeSize">The size of the chromosomes.</param>
 /// <param name="tradeSystemTemplate">A template to make TradeSystemChromosomes with</param>
 /// <param name="indicatorHelper">The indicator helper for generating new chromosomes.</param>
 /// <param name="breedingAlgorithm">The algorithm to breed with.</param>
 /// <param name="mutatingAlgorithm">The algorithm to mutate with.</param>
 /// <param name="fitnessAlgorithm">The algorithm to calculate fitness.</param>
 public GeneticAlgorithm(int chromosomes, int generations, int chromosomeSize, TradeSystem tradeSystemTemplate, IndicatorHelper indicatorHelper, IGeneticBreeding breedingAlgorithm, IGeneticMutating mutatingAlgorithm, IGeneticFitness fitnessAlgorithm)
 {
     this.chromosomes = new TradeSystemChromosome[chromosomes];
     for (int i = 0; i < chromosomes; i++)
     {
         TradeSystemChromosome newchromosome = new TradeSystemChromosome(tradeSystemTemplate, indicatorHelper, chromosomeSize);
         this.chromosomes[i] = newchromosome;
     }
     this.generations       = generations;
     this.breedingAlgorithm = breedingAlgorithm;
     this.fitnessAlgorithm  = fitnessAlgorithm;
     this.mutatingAlgorithm = mutatingAlgorithm;
     GeneratePopulation();
 }
 /// <summary>
 /// Initializes a new instance of the GeneticAlgorithm class.
 /// </summary>
 /// <param name="chromosomes">The number of chromosomes in the population.</param>
 /// <param name="generations">The number of generations to run.</param>
 /// <param name="chromosomeSize">The size of the chromosomes.</param>
 /// <param name="tradeSystemTemplate">A template to make TradeSystemChromosomes with</param>
 /// <param name="indicatorHelper">The indicator helper for generating new chromosomes.</param>
 /// <param name="breedingAlgorithm">The algorithm to breed with.</param>
 /// <param name="mutatingAlgorithm">The algorithm to mutate with.</param>
 /// <param name="fitnessAlgorithm">The algorithm to calculate fitness.</param>
 public GeneticAlgorithm(int chromosomes, int generations, int chromosomeSize, TradeSystem tradeSystemTemplate, IndicatorHelper indicatorHelper, IGeneticBreeding breedingAlgorithm, IGeneticMutating mutatingAlgorithm, IGeneticFitness fitnessAlgorithm)
 {
     /// *********************************************
     /// GDBCup - Code goes here
     /// *********************************************
 }