MOEA Framework 2.12
API Specification

org.moeaframework.core
Class NondominatedPopulation

java.lang.Object
  extended by org.moeaframework.core.Population
      extended by org.moeaframework.core.NondominatedPopulation
All Implemented Interfaces:
Iterable<Solution>
Direct Known Subclasses:
AdaptiveGridArchive, EpsilonBoxDominanceArchive, FitnessBasedArchive

public class NondominatedPopulation
extends Population

A population that maintains the property of pair-wise non-dominance between all solutions. When the add method is invoked with a new solution, all solutions currently in the population that are dominated by the new solution are removed. If the new solution is dominated by any member of the population, the new solution is not added.


Nested Class Summary
static class NondominatedPopulation.DuplicateMode
          Specifies how duplicate solutions are handled.
 
Field Summary
protected  DominanceComparator comparator
          The dominance comparator used by this non-dominated population.
protected  NondominatedPopulation.DuplicateMode duplicateMode
          Specifies how duplicate solutions are handled.
 
Constructor Summary
NondominatedPopulation()
          Constructs an empty non-dominated population using the Pareto dominance relation.
NondominatedPopulation(DominanceComparator comparator)
          Constructs an empty non-dominated population using the specified dominance relation.
NondominatedPopulation(DominanceComparator comparator, boolean allowDuplicates)
          Deprecated. Use NondominatedPopulation(DominanceComparator, DuplicateMode) instead.
NondominatedPopulation(DominanceComparator comparator, Iterable<? extends Solution> iterable)
          Constructs a non-dominated population using the specified dominance comparator and initialized with the specified solutions.
NondominatedPopulation(DominanceComparator comparator, NondominatedPopulation.DuplicateMode duplicateMode)
          Constructs an empty non-dominated population using the specified dominance relation.
NondominatedPopulation(Iterable<? extends Solution> iterable)
          Constructs a non-dominated population using the Pareto dominance relation and initialized with the specified solutions.
NondominatedPopulation(NondominatedPopulation.DuplicateMode duplicateMode)
          Constructs an empty non-dominated population using the Pareto dominance relation.
 
Method Summary
 boolean add(Solution newSolution)
          If newSolution is dominates any solution or is non-dominated with all solutions in this population, the dominated solutions are removed and newSolution is added to this population.
protected static double distance(Solution s1, Solution s2)
          Returns the Euclidean distance between two solutions in objective space.
protected  boolean forceAddWithoutCheck(Solution newSolution)
          Adds the specified solution to the population, bypassing the non-domination check.
 DominanceComparator getComparator()
          Returns the dominance comparator used by this non-dominated population.
protected  boolean isDuplicate(Solution s1, Solution s2)
          Returns true if the two solutions are duplicates and one should be ignored based on the duplicate mode.
 void replace(int index, Solution newSolution)
          Replace the solution at the given index with the new solution, but only if the new solution is non-dominated.
 
Methods inherited from class org.moeaframework.core.Population
addAll, addAll, clear, contains, containsAll, containsAll, get, indexOf, isEmpty, iterator, remove, remove, removeAll, removeAll, size, sort, truncate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparator

protected final DominanceComparator comparator
The dominance comparator used by this non-dominated population.


duplicateMode

protected final NondominatedPopulation.DuplicateMode duplicateMode
Specifies how duplicate solutions are handled.

Constructor Detail

NondominatedPopulation

public NondominatedPopulation()
Constructs an empty non-dominated population using the Pareto dominance relation.


NondominatedPopulation

public NondominatedPopulation(NondominatedPopulation.DuplicateMode duplicateMode)
Constructs an empty non-dominated population using the Pareto dominance relation.

Parameters:
duplicateMode - specifies how duplicate solutions are handled

NondominatedPopulation

public NondominatedPopulation(DominanceComparator comparator)
Constructs an empty non-dominated population using the specified dominance relation.

Parameters:
comparator - the dominance relation used by this non-dominated population

NondominatedPopulation

@Deprecated
public NondominatedPopulation(DominanceComparator comparator,
                                         boolean allowDuplicates)
Deprecated. Use NondominatedPopulation(DominanceComparator, DuplicateMode) instead.

Constructs an empty non-dominated population using the specified dominance relation.

Parameters:
comparator - the dominance relation used by this non-dominated population
allowDuplicates - allow duplicate solutions into the non-dominated population

NondominatedPopulation

public NondominatedPopulation(DominanceComparator comparator,
                              NondominatedPopulation.DuplicateMode duplicateMode)
Constructs an empty non-dominated population using the specified dominance relation.

Parameters:
comparator - the dominance relation used by this non-dominated population
duplicateMode - specifies how duplicate solutions are handled

NondominatedPopulation

public NondominatedPopulation(Iterable<? extends Solution> iterable)
Constructs a non-dominated population using the Pareto dominance relation and initialized with the specified solutions.

Parameters:
iterable - the solutions used to initialize this non-dominated population

NondominatedPopulation

public NondominatedPopulation(DominanceComparator comparator,
                              Iterable<? extends Solution> iterable)
Constructs a non-dominated population using the specified dominance comparator and initialized with the specified solutions.

Parameters:
comparator - the dominance relation used by this non-dominated population
iterable - the solutions used to initialize this non-dominated population
Method Detail

add

public boolean add(Solution newSolution)
If newSolution is dominates any solution or is non-dominated with all solutions in this population, the dominated solutions are removed and newSolution is added to this population. Otherwise, newSolution is dominated and is not added to this population.

Overrides:
add in class Population
Parameters:
newSolution - the solution to be added
Returns:
true if the population was modified as a result of this method; false otherwise.

replace

public void replace(int index,
                    Solution newSolution)
Replace the solution at the given index with the new solution, but only if the new solution is non-dominated. To maintain non-dominance within this population, any solutions dominated by the new solution will also be replaced.

Overrides:
replace in class Population
Parameters:
index - the index to replace
newSolution - the new solution

forceAddWithoutCheck

protected boolean forceAddWithoutCheck(Solution newSolution)
Adds the specified solution to the population, bypassing the non-domination check. This method should only be used when a non-domination check has been performed elsewhere, such as in a subclass.

This method should only be used internally, and should never be made public by any subclasses.

Parameters:
newSolution - the solution to be added
Returns:
true if the population was modified as a result of this operation

distance

protected static double distance(Solution s1,
                                 Solution s2)
Returns the Euclidean distance between two solutions in objective space.

Parameters:
s1 - the first solution
s2 - the second solution
Returns:
the distance between the two solutions in objective space

isDuplicate

protected boolean isDuplicate(Solution s1,
                              Solution s2)
Returns true if the two solutions are duplicates and one should be ignored based on the duplicate mode. This default implementation depends on the Object.equals(Object) method of the Variable class to check for equality of the decision variables.

Parameters:
s1 - the first solution
s2 - the second solution
Returns:
true if the solutions are duplicates; false otherwise

getComparator

public DominanceComparator getComparator()
Returns the dominance comparator used by this non-dominated population.

Returns:
the dominance comparator used by this non-dominated population

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!