Exemple #1
0
 /// <summary>
 ///     Creates a new <see cref="Population{TProgram,TOutput}" /> with the given arguments.
 /// </summary>
 /// <param name="maxSize">The maximum size of the population.</param>
 /// <param name="primitives">The primitive set used to generate new programs.</param>
 /// <param name="programGenerator">The generator of new programs.</param>
 /// <param name="programComparer">The function used to compare programs and select the best program.</param>
 /// <param name="selectionOperator">The operator to perform selection.</param>
 /// <param name="crossoverOperator">The operator to crossover programs. </param>
 /// <param name="mutationOperator">The operator to mutate programs.</param>
 /// <param name="maxGenerationDepth">The maximum depth of elements generated during GP.</param>
 /// <param name="maxElementLength">The maximum length of elements generated during GP.</param>
 /// <param name="crossoverPercent">The percentage of a population used for the crossover operator during GP.</param>
 /// <param name="mutationPercent">The percentage of a population used for the mutation operator during GP.</param>
 /// <param name="elitismPercent">The percentage of a population used for elite selection during GP.</param>
 public Population(
     uint maxSize,
     PrimitiveSet <TProgram> primitives,
     IProgramGenerator <TProgram, TOutput> programGenerator,
     IComparer <TProgram> programComparer,
     ISelectionOperator <TProgram> selectionOperator,
     ICrossoverOperator <TProgram> crossoverOperator,
     IMutationOperator <TProgram> mutationOperator,
     uint maxGenerationDepth = 4,
     uint maxElementLength   = 20,
     double crossoverPercent = 0.65d,
     double mutationPercent  = 0.2d,
     double elitismPercent   = 0.1d)
 {
     this._maxSize            = maxSize;
     this._primitives         = primitives;
     this._programGenerator   = programGenerator;
     this._maxGenerationDepth = maxGenerationDepth;
     this._maxElementLength   = maxElementLength;
     this._programComparer    = programComparer;
     this._selectionOperator  = selectionOperator;
     this._mutationOperator   = mutationOperator;
     this._crossoverOperator  = crossoverOperator;
     this.ElitismPercent      = elitismPercent;
     this.MutationPercent     = mutationPercent;
     this.CrossoverPercent    = crossoverPercent;
 }
Exemple #2
0
 /// <summary>
 ///     Creates anew <see cref="SubtreeMutation{TProgram,TOutput}" /> with the given arguments.
 /// </summary>
 /// <param name="programGenerator">The generator for new sub-programs. </param>
 /// <param name="primitives">The primitive set to be used in mutation operations.</param>
 /// <param name="maxDepth">The maximum depth of new random sub-programs.</param>
 public SubtreeMutation(
     IProgramGenerator <TProgram, TOutput> programGenerator, PrimitiveSet <TProgram> primitives,
     uint maxDepth)
 {
     this._primitives       = primitives;
     this._programGenerator = programGenerator;
     this.MaxDepth          = maxDepth;
 }
Exemple #3
0
 public ProjectTemplateEntry(IProgramGenerator projectGenerator)
 {
     ProjectGenerator = projectGenerator;
 }