jenes.stage
Class AlgorithmStage<T extends Chromosome>

java.lang.Object
  extended by jenes.stage.AbstractStage<T>
      extended by jenes.stage.AlgorithmStage<T>
Type Parameters:
T - The class chromosomes flowing across the stage.

public class AlgorithmStage<T extends Chromosome>
extends AbstractStage<T>

A stage wrapping an algoithm in order to make it part of a wider algorithm.

Since:
1.3
Version:
1.3
Author:
Luigi Troiano

Field Summary
 
Fields inherited from class jenes.stage.AbstractStage
biggerIsBetter, ga
 
Constructor Summary
AlgorithmStage(GeneticAlgorithm<T> algorithm)
          Builds a wrapper stage for the specified algorithm.
 
Method Summary
 GeneticAlgorithm<T> getAlgorithm()
          Returns the wrapped algorithm
 void process(Population<T> in, Population<T> out)
          Processes the input population and tranforms it into the output population.
 void setBiggerIsBetter(boolean flag, boolean globally)
          Sets if the best individuals have the higher fitness or not.
 
Methods inherited from class jenes.stage.AbstractStage
dispose, init, isBiggerBetter, setBiggerIsBetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlgorithmStage

public AlgorithmStage(GeneticAlgorithm<T> algorithm)
Builds a wrapper stage for the specified algorithm.

Parameters:
algorithm - the algorithm to wrap.
Method Detail

getAlgorithm

public final GeneticAlgorithm<T> getAlgorithm()
Returns the wrapped algorithm

Returns:
the algorithm

setBiggerIsBetter

public void setBiggerIsBetter(boolean flag,
                              boolean globally)
Description copied from class: AbstractStage
Sets if the best individuals have the higher fitness or not. This setting can be or not propagated down to sub-stages.

Overrides:
setBiggerIsBetter in class AbstractStage<T extends Chromosome>
Parameters:
flag - true, if the best individual has the higher fitness
globally - true, to propagate this setting down, otherwise false.

process

public void process(Population<T> in,
                    Population<T> out)
             throws StageException
Description copied from class: AbstractStage
Processes the input population and tranforms it into the output population. Note: - Out population is made of recicled individuals. There is a need of new individuals to add only when there is a need to increase the population size. For pre-initalized individual just use setAs method. This is done for an efficient memory management. - A stage can modify the input population. So input passed to process method can be mutated when the process method ends.

Specified by:
process in class AbstractStage<T extends Chromosome>
Parameters:
in - the input population
out - the output population
Throws:
StageException