|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjenes.stage.AbstractStage<T>
jenes.stage.Parallel<T>
T
- The class chromosomes flowing across the stage.public class Parallel<T extends Chromosome>
A parallel is formed by differents branches; each branch receives a subpopolation according to the
population dispenser used (see Dispenser.distribute(Population, Population[])
).
Each branch is a stage and can be added with the add(AbstractStage)
method.
The output population is obtained merging the output of each branch.
The dispenser is responsable of this merging.
Note: generally a dispenser can add the same input individual in different branches. So don't modify the stages input individuals.
Dispenser
,
ExclusiveDispenser
Field Summary |
---|
Fields inherited from class jenes.stage.AbstractStage |
---|
biggerIsBetter, ga |
Constructor Summary | |
---|---|
Parallel(Dispenser<T> dispenser)
Constructs a new parallel stage with the specified dispenser. |
Method Summary | |
---|---|
void |
add(AbstractStage<T> stage)
Adds a new branch to this parallel stage. |
void |
dispose()
Disposes this stage |
protected void |
distribute(Population<T> in,
Population<T>[] branches)
Distributes the specified population between those ones in the specified array. |
void |
init(GeneticAlgorithm<T> ga)
Initializes this stage according to the genetic algorithm that uses it |
protected void |
mergePopulation(Population<T>[] branches,
Population<T> out)
Merges the populations within the specified array in the specified one. |
void |
process(Population<T> in,
Population<T> out)
Processes the input population and tranforms it into the output population. |
void |
remove(AbstractStage<T> stage)
Removes a stage from the parallel andall the stages it contains. |
void |
remove(int index)
Removes a specified branch from the parallel |
void |
removeAllBranches()
Removes all the branch stages from this parallel |
void |
setBiggerIsBetter(boolean flag,
boolean globally)
Sets if the best individuals have the higher fitness or not. |
void |
setBranch(int index,
AbstractStage<T> stage)
Sets the specified stage at the specified branch number replacing the stage already present |
Methods inherited from class jenes.stage.AbstractStage |
---|
isBiggerBetter, setBiggerIsBetter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Parallel(Dispenser<T> dispenser)
dispenser
- the dispenser to use in the distribute and merge operationsMethod Detail |
---|
public void add(AbstractStage<T> stage)
stage
- the stage to be added as branchpublic void remove(AbstractStage<T> stage)
stage
- the stage to removepublic void remove(int index)
index
- the branch index to removepublic void setBranch(int index, AbstractStage<T> stage)
index
- the branch number where to set the new stagestage
- the stage to addpublic void removeAllBranches()
public void init(GeneticAlgorithm<T> ga) throws StageException
AbstractStage
init
in class AbstractStage<T extends Chromosome>
ga
- the Genetic Algorithm in wchic this stage run
StageException
public void dispose()
AbstractStage
dispose
in class AbstractStage<T extends Chromosome>
public 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 population
StageException
protected void distribute(Population<T> in, Population<T>[] branches)
in
- he population to distributebranches
- the array of sub populations to fillprotected void mergePopulation(Population<T>[] branches, Population<T> out)
branches
- the populations to be mergedout
- the final populationpublic void setBiggerIsBetter(boolean flag, boolean globally)
AbstractStage
setBiggerIsBetter
in class AbstractStage<T extends Chromosome>
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 |