Method | Description | |
---|---|---|
AddChromosome ( IChromosome chromosome ) : void |
Add chromosome to the population. The method adds specified chromosome to the current population. Manual adding of chromosome maybe useful, when it is required to add some initialized chromosomes instead of random. |
|
Crossover ( ) : void |
Do crossover in the population. The method walks through the population and performs crossover operator taking each two chromosomes in the order of their presence in the population. The total amount of paired chromosomes is determined by |
|
Migrate ( |
Perform migration between two populations. The method performs migration between two populations - current and the |
|
Mutate ( ) : void |
Do mutation in the population. The method walks through the population and performs mutation operator taking each chromosome one by one. The total amount of mutated chromosomes is determined by |
|
Population ( int size, IChromosome ancestor, IFitnessFunction fitnessFunction, ISelectionMethod selectionMethod ) : System |
Initializes a new instance of the Population class. Creates new population of specified size. The specified ancestor becomes first member of the population and is used to create other members with same parameters, which were used for ancestor's creation. |
|
Regenerate ( ) : void |
Regenerate population. The method regenerates population filling it with random chromosomes. |
|
Resize ( int newPopulationSize ) : void |
Resize population to the new specified size. The method does resizing of population. In the case if population should grow, it just adds missing number of random members. In the case if population should get smaller, the |
|
Resize ( int newPopulationSize, ISelectionMethod membersSelector ) : void |
Resize population to the new specified size. The method does resizing of population. In the case if population should grow, it just adds missing number of random members. In the case if population should get smaller, the specified selection method is used to reduce the population. |
|
RunEpoch ( ) : void |
Run one epoch of the population. The method runs one epoch of the population, doing crossover, mutation and selection by calling Crossover, Mutate and Selection. |
|
Selection ( ) : void |
Do selection. The method applies selection operator to the current population. Using specified selection algorithm it selects members to the new generation from current generates and adds certain amount of random members, if is required (see RandomSelectionPortion). |
|
Shuffle ( ) : void |
Shuffle randomly current population. Population shuffling may be useful in cases when selection operator results in not random order of chromosomes (for example, after elite selection population may be ordered in ascending/descending order). |
|
this ( int index ) : IChromosome |
Get chromosome with specified index. Allows to access individuals of the population. |
Method | Description | |
---|---|---|
FindBestChromosome ( ) : void |
public AddChromosome ( IChromosome chromosome ) : void | ||
chromosome | IChromosome | Chromosome to add to the population. |
return | void |
public Migrate ( |
||
anotherPopulation | Population to do migration with. | |
numberOfMigrants | int | Number of chromosomes from each population to migrate. |
migrantsSelector | ISelectionMethod | Selection algorithm used to select chromosomes to migrate. |
return | void |
public Population ( int size, IChromosome ancestor, IFitnessFunction fitnessFunction, ISelectionMethod selectionMethod ) : System | ||
size | int | Initial size of population. |
ancestor | IChromosome | Ancestor chromosome to use for population creatioin. |
fitnessFunction | IFitnessFunction | Fitness function to use for calculating /// chromosome's fitness values. |
selectionMethod | ISelectionMethod | Selection algorithm to use for selection /// chromosome's to new generation. |
return | System |
public Resize ( int newPopulationSize ) : void | ||
newPopulationSize | int | New size of population. |
return | void |
public Resize ( int newPopulationSize, ISelectionMethod membersSelector ) : void | ||
newPopulationSize | int | New size of population. |
membersSelector | ISelectionMethod | Selection algorithm to use in the case /// if population should get smaller. |
return | void |
public this ( int index ) : IChromosome | ||
index | int | Chromosome's index to retrieve. |
return | IChromosome |