|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jenes.stage.AbstractStage<T>
T
- The class chromosomes flowing across the stage.public abstract class AbstractStage<T extends Chromosome>
A generic genetic algorithm stage.
In Jenes the genetic algorithm body is a "pipe" of stages:
each stage processes the input population and produces the output population.
A genetic algoritm invokes the process(Population, Population)
method of each stage.
It is important to consider that the output population is pre-initialized with recicled individuals (for performance reasons),
so 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.
Note: a stage can modify the input population. So input passed to process method
can be mutated when the process method ends.
Field Summary | |
---|---|
protected boolean |
biggerIsBetter
True if higher scores entail better individuals |
protected GeneticAlgorithm<T> |
ga
The genetic algorithm, this stage belongs to |
Constructor Summary | |
---|---|
AbstractStage()
|
Method Summary | |
---|---|
void |
dispose()
Disposes this stage |
void |
init(GeneticAlgorithm<T> ga)
Initializes this stage according to the genetic algorithm that uses it |
boolean |
isBiggerBetter()
Says if the best individuals have the higher fitness or not. |
abstract void |
process(Population<T> in,
Population<T> out)
Processes the input population and tranforms it into the output population. |
void |
setBiggerIsBetter(boolean flag)
Sets if the best individuals have the higher fitness or not. |
void |
setBiggerIsBetter(boolean flag,
boolean globally)
Sets if the best individuals have the higher fitness or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GeneticAlgorithm<T extends Chromosome> ga
protected boolean biggerIsBetter
Constructor Detail |
---|
public AbstractStage()
Method Detail |
---|
public abstract void process(Population<T> in, Population<T> out) throws StageException
in
- the input populationout
- the output population
StageException
public void init(GeneticAlgorithm<T> ga) throws StageException
ga
- the Genetic Algorithm in wchic this stage run
StageException
public void dispose() throws StageException
StageException
public boolean isBiggerBetter()
true
if the best individuals have the higher fitness> false
otherwisepublic void setBiggerIsBetter(boolean flag)
flag
- true, if the best individual has the higher fitnesspublic void setBiggerIsBetter(boolean flag, boolean globally)
flag
- true, if the best individual has the higher fitnessglobally
- true, to propagate this setting down, otherwise false.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |