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
Nested ClassesModifier and TypeClassDescriptionprotected classComparator that sorts theIndividuals based on their fitness values. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateFitness(Collection<Individual> population) Calculates the fitness of theIndividuals: 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 ofIndividuals and returns it as a newCollection.voidinit(int maxsize) Sets the maximal number ofIndividuals.
-
Field Details
-
random
-
fitness
-
-
Constructor Details
-
ElitismSelector
Constructs anElitismSelector.- Parameters:
random- the random number generator
-
-
Method Details
-
getLames
Description copied from interface:SelectorSelects a subset oflambdaIndividuals and returns it as a newCollection. These individuals can be erased in the next generation. -
getParents
Description copied from interface:SelectorSelects a subset ofIndividuals and returns it as a newCollection. These so called parents can be used to form the next generation.- Specified by:
getParentsin interfaceSelector- Parameters:
mu- the number of parents to selectpopulation- the list of individuals- Returns:
- the parents
-
calculateFitness
Calculates the fitness of theIndividuals: 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:SelectorSets the maximal number ofIndividuals.
-