public class SimpleDispenser<T extends Chromosome> extends ExclusiveDispenser<T>
GeneticAlgorithm
and how to use
the flexible and configurable breeding structure in Jenes.
The problem consists in searching a pattern of integers with a given precision.
Solutions flow through two different crossovers in parallel. Some are processed by
a single point crossover, the other by a double point crossover.
After solutions are mutated.
This class implements the strategy for dispensing solutions in the two branches.
Odd solutions goes to the first, even to the second.Constructor and Description |
---|
SimpleDispenser(int span) |
Modifier and Type | Method and Description |
---|---|
int |
distribute(Individual<T> ind)
Returns the branch number where to add the specified individual.
|
void |
preDistribute(Population<T> population)
Callback method invoked just before distribution of individuals begins.
|
distribute, mergePopulation, postDistribute, postMerge, preMerge
public void preDistribute(Population<T> population)
ExclusiveDispenser
preDistribute
in class ExclusiveDispenser<T extends Chromosome>
population
- the population to distributepublic int distribute(Individual<T> ind)
ExclusiveDispenser
distribute
in class ExclusiveDispenser<T extends Chromosome>
ind
- the individual to distribute