Package org.opt4j.optimizer.ea
Class Nsga2
- java.lang.Object
-
- org.opt4j.optimizer.ea.Nsga2
-
- All Implemented Interfaces:
Selector
- Direct Known Subclasses:
SelectorDefault
public class Nsga2 extends Object implements Selector
- See Also:
Nsga2Module
, "A Fast Elitist Non-Dominated Sorting Genetic Algorithm for Multi-Objective Optimization: NSGA-II, K. Deb, Samir Agrawal, Amrit Pratap, and T. Meyarivan, Parallel MockProblem Solving from Nature, 2000"
-
-
Field Summary
Fields Modifier and Type Field Description protected FrontDensityIndicator
indicator
protected Random
random
protected int
tournament
-
Constructor Summary
Constructors Constructor Description Nsga2(Rand random, int tournament, FrontDensityIndicator indicator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<List<Individual>>
fronts(Collection<Individual> individuals)
Evaluate the fronts and set the correspondent rank values.Collection<Individual>
getLames(int n, Collection<Individual> population)
Collection<Individual>
getParents(int mu, Collection<Individual> population)
Selects a subset ofIndividual
s and returns it as a newCollection
.protected Map<Individual,Integer>
getRank(List<List<Individual>> fronts)
Determine the ranks of fronts.void
init(int maxsize)
Sets the maximal number ofIndividual
s.
-
-
-
Field Detail
-
random
protected final Random random
-
tournament
protected final int tournament
-
indicator
protected final FrontDensityIndicator indicator
-
-
Constructor Detail
-
Nsga2
@Inject public Nsga2(Rand random, int tournament, FrontDensityIndicator indicator)
- Parameters:
random
- the random number generatortournament
- the tournament value
-
-
Method Detail
-
init
public void init(int maxsize)
Description copied from interface:Selector
Sets the maximal number ofIndividual
s.
-
getParents
public Collection<Individual> getParents(int mu, Collection<Individual> population)
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
-
getLames
public Collection<Individual> getLames(int n, Collection<Individual> population)
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.
-
getRank
protected Map<Individual,Integer> getRank(List<List<Individual>> fronts)
Determine the ranks of fronts.- Parameters:
fronts
- the fronts- Returns:
- the ranks
-
fronts
public List<List<Individual>> fronts(Collection<Individual> individuals)
Evaluate the fronts and set the correspondent rank values.- Parameters:
individuals
- the individuals- Returns:
- the fronts
-
-