T
- The class chromosomes flowing across the stage.public class Sequence<T extends Chromosome> extends AbstractStage<T>
biggerIsBetter, fitness, ga
Constructor and Description |
---|
Sequence()
Constructs a new sequence stage.
|
Modifier and Type | Method and Description |
---|---|
void |
appendStage(AbstractStage<T> stage)
Adds the specified stage at the end of this sequence
|
void |
dispose()
Disposes all of its internal stages
|
int |
getSize()
Returns the number of stages
|
AbstractStage<T> |
getStageAt(int pos)
Returns the stage at the specified position
|
void |
init(GeneticAlgorithm<T> ga)
Initializes all of its internal stages
|
void |
insertStageAt(AbstractStage<T> stage,
int pos)
Adds the specified stage to the specified position
|
void |
process(Population<T> in,
Population<T> out)
Invokes the process method on all of its internal stages
|
void |
removeAll()
Removes all the stages from this sequence
|
AbstractStage<T> |
removeAt(int pos)
Removes the stage at the specified position
|
void |
setBiggerIsBetter(boolean flag,
boolean recursively)
Deprecated.
|
void |
setFitness(Fitness fit,
boolean recursively)
Change the
Fitness to this stage propagating the change recursively
according to the flag given as parameter |
getFitness, isBiggerBetter, isFitnessChanged, setBiggerIsBetter, setFitness
public void appendStage(AbstractStage<T> stage)
stage
- the stage to addpublic void insertStageAt(AbstractStage<T> stage, int pos)
stage
- the stage to addpos
- the position where to insert the new stagepublic void removeAll()
public int getSize()
public AbstractStage<T> getStageAt(int pos)
pos
- index of the stage to returnpublic AbstractStage<T> removeAt(int pos)
pos
- the position of the stage to removepublic void init(GeneticAlgorithm<T> ga)
init
in class AbstractStage<T extends Chromosome>
ga
- the Genetic Algorithm in wchic this stage runpublic void dispose()
dispose
in class AbstractStage<T extends Chromosome>
public final void process(Population<T> in, Population<T> out) throws StageException
process
in class AbstractStage<T extends Chromosome>
in
- the input populationout
- the output populationStageException
@Deprecated public void setBiggerIsBetter(boolean flag, boolean recursively)
setBiggerIsBetter
in class AbstractStage<T extends Chromosome>
flag
- true, if the best individual has the higher fitnessrecursively
- true, to propagate this setting down, otherwise false.public void setFitness(Fitness fit, boolean recursively)
AbstractStage
Fitness
to this stage propagating the change recursively
according to the flag given as parametersetFitness
in class AbstractStage<T extends Chromosome>