|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jenes.stage.AbstractStage<T> jenes.stage.operator.Operator<T> jenes.stage.operator.Selector<T>
T
- The class of chromosomes to work with.public abstract class Selector<T extends Chromosome>
A class representing a generic selection operator.
The actual selector is implemented by subclassing this abstract class and providing the select(Population)
and
preSelect(Population)
method implementations: the former is required to select individuals from
the specified Population
; the latter is required to set up the selector state when a new selection begins.
A maxIllegalRate
is specified to obtain a population with a max number of illegal individuals selected.
When this threshould is reached, the new illegal selected individuals are not added at the output population, and the
selection process is repeated.
At the start selection time the output population has already the individuals; the individuals selected from the input population have not to be added at the output population: each output population individual is set as the one selected by the input population.
The output population size will be equal to the input population one; automatically new individuals are added or old ones are deleted to make the sizes equal.
A Selector.Statistics
is associated to each selector operator.
Individual
,
Population
Nested Class Summary | |
---|---|
class |
Selector.Statistics
A statistics object holding the number of selection performed and the time spent to execute them. |
Field Summary | |
---|---|
static double |
DEFAULT_MAX_ILLEGAL_RATE
The default percentage of allowed illegal individuals |
Fields inherited from class jenes.stage.operator.Operator |
---|
random, statistics |
Fields inherited from class jenes.stage.AbstractStage |
---|
biggerIsBetter, ga |
Constructor Summary | |
---|---|
Selector()
Constructs a new SelectorOperator with the specified sample individual |
Method Summary | |
---|---|
double |
getMaxIllegalRate()
Returns the max number of illegal individuals this selector operator can select. |
protected void |
preSelect(Population<T> pop)
Sets up the selection state according a population's state. |
void |
process(Population<T> in,
Population<T> out)
Sets the individuals in the output population like the selected ones |
protected abstract Individual<T> |
select(Population<T> pop)
Selects a population according to a politics of selection. |
void |
setMaxIllegalRate(double rate)
Sets the max number of illegal individuals this selector operator can select. |
Methods inherited from class jenes.stage.operator.Operator |
---|
getStatistics, updateStatistics |
Methods inherited from class jenes.stage.AbstractStage |
---|
dispose, init, isBiggerBetter, setBiggerIsBetter, setBiggerIsBetter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_MAX_ILLEGAL_RATE
Constructor Detail |
---|
public Selector()
Method Detail |
---|
public double getMaxIllegalRate()
public void setMaxIllegalRate(double rate)
rate
- the max illegal ratepublic final void process(Population<T> in, Population<T> out) throws StageException
process
in class AbstractStage<T extends Chromosome>
in
- the input populationout
- the output population
StageException
protected void preSelect(Population<T> pop)
pop
- the population to process by the stageprotected abstract Individual<T> select(Population<T> pop)
pop
- the population in which to choose the individual
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |