-
-
Notifications
You must be signed in to change notification settings - Fork 334
The mutation rate can be changed on MutationProbability property of GeneticAlgorithm class:
var ga = new GeneticAlgorithm(population, fitness, selection, crossover, mutation);
ga.MutationProbability = 0.2f;
ga.Start();
The Population class allows you to define the minimum and maximum size of a population in the constructor:
// The line below will create a population that has a min size of 50 chromosomes and a max size of 70 chromosomes.
var population = new Population (50, 70, chromosome);
var ga = new GeneticAlgorithm(population, fitness, selection, crossover, mutation);
ga.Start();
When the method Start of GeneticAlgorithm is called, the GA will run until the current termination be reached. You can define the termination in the Termination property.
The default termination property is one generation:
ga.Termination = new GenerationNumberTermination(1);
If you want to run your GA until 100 generations, just set it:
ga.Termination = new GenerationNumberTermination(100);
ga.Start();
GeneticSharp does not support multi-objective GAs and there is no plan for something like this.
The default mutation probability is defined in the constant GeneticAlgorithm.DefaultMutationProbability. The current value is 0.1f;
Take a look on the issues with "question" tag.