Package org.opt4j.optimizer.ea
Class ElitismSelector
java.lang.Object
org.opt4j.optimizer.ea.ElitismSelector
- All Implemented Interfaces:
Selector
The
ElitismSelector
is a single objective elitism select. If a
multi-objective problem is optimized, the objectives are summed up to a
single value.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Comparator that sorts theIndividual
s based on their fitness values. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
calculateFitness
(Collection<Individual> population) Calculates the fitness of theIndividual
s: the sum of all double values (these always have to be minimized) of the objectives.getLames
(int lambda, Collection<Individual> population) getParents
(int mu, Collection<Individual> population) Selects a subset ofIndividual
s and returns it as a newCollection
.void
init
(int maxsize) Sets the maximal number ofIndividual
s.
-
Field Details
-
random
-
fitness
-
-
Constructor Details
-
ElitismSelector
Constructs anElitismSelector
.- Parameters:
random
- the random number generator
-
-
Method Details
-
getLames
Description copied from interface:Selector
Selects a subset oflambda
Individual
s and returns it as a newCollection
. These individuals can be erased in the next generation. -
getParents
Description copied from interface:Selector
Selects a subset ofIndividual
s and returns it as a newCollection
. These so called parents can be used to form the next generation.- Specified by:
getParents
in interfaceSelector
- Parameters:
mu
- the number of parents to selectpopulation
- the list of individuals- Returns:
- the parents
-
calculateFitness
Calculates the fitness of theIndividual
s: the sum of all double values (these always have to be minimized) of the objectives.- Parameters:
population
-
-
init
public void init(int maxsize) Description copied from interface:Selector
Sets the maximal number ofIndividual
s.
-