T
- The class chromosomes flowing across the stage.public abstract class AbstractStage<T extends Chromosome>
extends java.lang.Object
process(Population, Population)
method of each stage.
process(Population, Population)
generally doesn't allocate new Individuals but only changes the genome of that in the output population.
The default output population size is equal to the input one,
but the stage can (if needed) add or remove individuals from the output population.
Modifier and Type | Field and Description |
---|---|
protected boolean |
biggerIsBetter
True if higher scores entail better individuals
|
protected Fitness<T> |
fitness
The current Fitness
|
protected GeneticAlgorithm<T> |
ga
The genetic algorithm, this stage belongs to
|
Constructor and Description |
---|
AbstractStage() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this stage
|
Fitness<T> |
getFitness()
Get the
Fitness currently setted for this stage |
void |
init(GeneticAlgorithm<T> ga)
Initializes this stage according to the genetic algorithm
that uses it
|
boolean |
isBiggerBetter()
Deprecated.
deprecated due to the use of
Fitness . In next releasese this method will be removed
Says if the best individuals have the higher fitness or not. |
boolean |
isFitnessChanged()
Test if the fitness is recently changed
|
abstract void |
process(Population<T> in,
Population<T> out)
Processes the input population and tranforms it into the output population.
|
void |
setBiggerIsBetter(boolean flags)
Deprecated.
deprecated due to the use of
Fitness . In next releasese this method will be removed
Sets if the best individuals have the higher fitness or not.
For maximization, this property is set to true;
for minimization, this property is set to false.
This setting is propagated down to every sub-stage the stage is made of. |
void |
setBiggerIsBetter(boolean flag,
boolean recursively)
Deprecated.
deprecated due to the use of
Fitness . In next releasese this method will be removed
Sets if the best individuals have the higher fitness or not.
This setting can be or not propagated down to sub-stages. |
void |
setFitness(Fitness<T> fit)
Change the
Fitness to this stage propagating the change recursively |
void |
setFitness(Fitness<T> fit,
boolean recursively)
Change the
Fitness to this stage propagating the change recursively
according to the flag given as parameter |
protected GeneticAlgorithm<T extends Chromosome> ga
protected boolean biggerIsBetter
protected Fitness<T extends Chromosome> fitness
public abstract void process(Population<T> in, Population<T> out) throws StageException
in
- the input populationout
- the output populationStageException
public void init(GeneticAlgorithm<T> ga) throws StageException
ga
- the Genetic Algorithm in wchic this stage runStageException
public void dispose() throws StageException
StageException
public boolean isBiggerBetter()
Fitness
. In next releasese this method will be removed
Says if the best individuals have the higher fitness or not.true
if the best individuals have the higher fitness> false
otherwisepublic void setBiggerIsBetter(boolean flags)
Fitness
. In next releasese this method will be removed
Sets if the best individuals have the higher fitness or not.
For maximization, this property is set to true;
for minimization, this property is set to false.
This setting is propagated down to every sub-stage the stage is made of.flag
- true, if the best individual has the higher fitnesspublic void setBiggerIsBetter(boolean flag, boolean recursively)
Fitness
. In next releasese this method will be removed
Sets if the best individuals have the higher fitness or not.
This setting can be or not propagated down to sub-stages.flag
- true, if the best individual has the higher fitnessrecursively
- true, to propagate this setting down, otherwise false.public final Fitness<T> getFitness()
Fitness
currently setted for this stagepublic void setFitness(Fitness<T> fit)
Fitness
to this stage propagating the change recursivelyfit
- public void setFitness(Fitness<T> fit, boolean recursively)
Fitness
to this stage propagating the change recursively
according to the flag given as parameterfit
- recursively
- public boolean isFitnessChanged()