T
- The class of chromosomes to work with.public abstract class Mutator<T extends Chromosome> extends Operator<T>
The actual operator is implemented by subclassing this abstract class and providing the mutate(Individual)
implementation: the method is required to mutate an Individual
according to a mutation strategy.
No new individual copies have to be created during the mutation operation: the individual specified at the mutate(Individual)
will take parte to the output mutator population.
A Mutator.Statistics
is associated to each mutator operator.
Individual
,
Population
Modifier and Type | Class and Description |
---|---|
class |
Mutator.Statistics
A statistics object holding the number of mutation performed and the time spent to execute them.
|
Modifier and Type | Field and Description |
---|---|
protected double |
probability
The mutation probablility
|
random, statistics
biggerIsBetter, fitness, ga
Constructor and Description |
---|
Mutator(double probability)
Constructs a new mutator instance with the specified mutator probability
|
Modifier and Type | Method and Description |
---|---|
double |
getProbability()
Returns the mutator probability
|
protected abstract void |
mutate(Individual<T> t)
Mutates a single individual.
|
void |
process(Population<T> in,
Population<T> out)
Processes the input population and tranforms it into the output population.
|
void |
setProbability(double probability)
Sets the mutator probability
|
getStatistics, updateStatistics
dispose, getFitness, init, isBiggerBetter, isFitnessChanged, setBiggerIsBetter, setBiggerIsBetter, setFitness, setFitness
public Mutator(double probability)
probability
- the mutator probabilitypublic double getProbability()
public void setProbability(double probability)
probability
- the new mutator probabilitypublic final void process(Population<T> in, Population<T> out) throws StageException
AbstractStage
process
in class AbstractStage<T extends Chromosome>
in
- the input populationout
- the output populationStageException
protected abstract void mutate(Individual<T> t)
t
- the individual to mutate