Package org.opt4j.optimizers.ea
Class Hypervolume
- java.lang.Object
-
- org.opt4j.optimizers.ea.Hypervolume
-
- All Implemented Interfaces:
org.opt4j.core.common.archive.FrontDensityIndicator
public class Hypervolume extends java.lang.Object implements org.opt4j.core.common.archive.FrontDensityIndicator
TheHypervolume
, see "Zitzler, E., and Thiele, L. (1998): Multiobjective Optimization Using Evolutionary Algorithms - A Comparative Case Study. Parallel Problem Solving from Nature (PPSN-V), 292-301." is aFrontDensityIndicator
based on determination of the hypervolume contribution. The calculation is based on a normalization between 0 and 1 in each dimension and a transformation to a maximization problem. Additionally an offset value (default 1) is added to each dimension.- See Also:
SMSModule
-
-
Field Summary
Fields Modifier and Type Field Description protected double
offset
-
Constructor Summary
Constructors Constructor Description Hypervolume(double offset)
Constructs aHypervolume
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
calculateHypervolume(java.util.List<double[]> front, int nObjectives)
Implements theHypervolume
calculations as proposed by Zitzler, E., and Thiele, L. (1998).protected java.util.Map<org.opt4j.core.Individual,java.lang.Double>
calculateHypervolumeContribution2D(java.util.List<org.opt4j.core.Individual> individuals, double offset)
Calculates theHypervolume
contribution for two dimensions.protected java.util.Map<org.opt4j.core.Individual,java.lang.Double>
calculateHypervolumeContributionN(java.util.List<org.opt4j.core.Individual> individuals, double offset)
Calculates theHypervolume
contribution for n dimensions.protected boolean
dominates(double[] p1, double[] p2, int nObjectives)
protected java.util.List<double[]>
filterNondominatedSet(java.util.List<double[]> front, int nObjectives)
java.util.Map<org.opt4j.core.Individual,java.lang.Double>
getDensityValues(java.util.Collection<org.opt4j.core.Individual> individuals)
protected java.util.Map<org.opt4j.core.Individual,java.lang.Double>
getDensityValues(java.util.Collection<org.opt4j.core.Individual> individuals, double offset)
Calculates the density values for a front of non-dominated individuals based on the contribution of theHypervolume
.protected java.util.List<double[]>
getMinValues(java.util.List<org.opt4j.core.Individual> individuals)
Transforms the non-dominatedIndividual
s to a front where each objective is to be minimized.protected java.util.List<double[]>
invert(java.util.List<double[]> front, double offset)
Inverts (from a minimization to a maximization problem) a front of solutions and adds an offset value to each dimension.protected java.util.List<double[]>
normalize(java.util.List<double[]> front)
Normalizes a front of non-dominated solutions to values between 0 and 1.protected void
reduceNondominatedSet(java.util.List<double[]> front, int objective, double threshold)
protected double
surfaceUnchangedTo(java.util.List<double[]> front, int objective)
-
-
-
Constructor Detail
-
Hypervolume
@Inject public Hypervolume(double offset)
Constructs aHypervolume
.- Parameters:
offset
- the offset that is added to each dimension before the hypervolume is calculated
-
-
Method Detail
-
getDensityValues
public java.util.Map<org.opt4j.core.Individual,java.lang.Double> getDensityValues(java.util.Collection<org.opt4j.core.Individual> individuals)
- Specified by:
getDensityValues
in interfaceorg.opt4j.core.common.archive.FrontDensityIndicator
-
getDensityValues
protected java.util.Map<org.opt4j.core.Individual,java.lang.Double> getDensityValues(java.util.Collection<org.opt4j.core.Individual> individuals, double offset)
Calculates the density values for a front of non-dominated individuals based on the contribution of theHypervolume
. A special approach for two dimension exists as well as a general approach for n dimensions.- Parameters:
individuals
- the individualsoffset
- the offset- Returns:
- the map of density values
-
calculateHypervolumeContributionN
protected java.util.Map<org.opt4j.core.Individual,java.lang.Double> calculateHypervolumeContributionN(java.util.List<org.opt4j.core.Individual> individuals, double offset)
Calculates theHypervolume
contribution for n dimensions.- Parameters:
individuals
- the individualsoffset
- the offset- Returns:
- the map of density values
-
calculateHypervolumeContribution2D
protected java.util.Map<org.opt4j.core.Individual,java.lang.Double> calculateHypervolumeContribution2D(java.util.List<org.opt4j.core.Individual> individuals, double offset)
Calculates theHypervolume
contribution for two dimensions.- Parameters:
individuals
- the individualsoffset
- the offset- Returns:
- the map of density values
-
getMinValues
protected java.util.List<double[]> getMinValues(java.util.List<org.opt4j.core.Individual> individuals)
Transforms the non-dominatedIndividual
s to a front where each objective is to be minimized.- Parameters:
individuals
- the individuals- Returns:
- the front of vectors that is minimized
-
normalize
protected java.util.List<double[]> normalize(java.util.List<double[]> front)
Normalizes a front of non-dominated solutions to values between 0 and 1.- Parameters:
front
- the front of non-dominated solutions- Returns:
- the normalized front
-
invert
protected java.util.List<double[]> invert(java.util.List<double[]> front, double offset)
Inverts (from a minimization to a maximization problem) a front of solutions and adds an offset value to each dimension.- Parameters:
front
- the front of non-dominated solutionsoffset
- the offset- Returns:
- the inverted front
-
calculateHypervolume
protected double calculateHypervolume(java.util.List<double[]> front, int nObjectives)
Implements theHypervolume
calculations as proposed by Zitzler, E., and Thiele, L. (1998). All points have positive values in all dimensions and the hypervolume is calculated from 0.- Parameters:
front
- the front of non-dominated solutionsnObjectives
- the number of objectives- Returns:
- the hypervolume
-
filterNondominatedSet
protected java.util.List<double[]> filterNondominatedSet(java.util.List<double[]> front, int nObjectives)
-
dominates
protected boolean dominates(double[] p1, double[] p2, int nObjectives)
-
surfaceUnchangedTo
protected double surfaceUnchangedTo(java.util.List<double[]> front, int objective)
-
reduceNondominatedSet
protected void reduceNondominatedSet(java.util.List<double[]> front, int objective, double threshold)
-
-