jenes.tutorials.problem2
Class SimpleDispenser<T extends Chromosome>
java.lang.Object
jenes.stage.Dispenser<T>
jenes.stage.ExclusiveDispenser<T>
jenes.tutorials.problem2.SimpleDispenser<T>
public class SimpleDispenser<T extends Chromosome>
- extends ExclusiveDispenser<T>
Tutorial showing how to extend 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.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Luigi Troiano, Pierpaolo Lombardi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleDispenser
public SimpleDispenser(int span)
preDistribute
public void preDistribute(Population<T> population)
- Description copied from class:
ExclusiveDispenser
- Sets up the switcher state according to the population's state. It's invoked
at the start of individual distribution of the specified population.
- Overrides:
preDistribute
in class ExclusiveDispenser<T extends Chromosome>
- Parameters:
population
- the population to distribute
distribute
public int distribute(Individual<T> ind)
- Description copied from class:
ExclusiveDispenser
- Returns the branch number where to add the specified individual.
Branches are numbered from 0 to span-1
- Specified by:
distribute
in class ExclusiveDispenser<T extends Chromosome>
- Parameters:
ind
- the individual to distribute
- Returns:
- the branch number where to add the individual