|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.moeaframework.core.Population
org.moeaframework.core.NondominatedSortingPopulation
public class NondominatedSortingPopulation
Population that maintains the rank and crowdingDistance
attributes for its solutions by invoking
FastNondominatedSorting.evaluate(Population). This population tracks
modifications and performs fast non-dominated sorting only when required.
Only changes made to this population can be tracked; changes made directly
to the contained solutions will not be detected. Therefore, it may be
necessary to invoke update() manually.
The iterator() method returned by Population must use the
size(), get(int) and remove(int) methods to ensure
proper functionality.
| Constructor Summary | |
|---|---|
NondominatedSortingPopulation()
Constructs an empty population that maintains the rank and
crowdingDistance attributes for its solutions. |
|
NondominatedSortingPopulation(DominanceComparator comparator)
Constructs an empty population that maintains the rank and
crowdingDistance attributes for its solutions. |
|
NondominatedSortingPopulation(DominanceComparator comparator,
Iterable<? extends Solution> iterable)
Constructs a population initialized with the specified solutions that maintains the rank and crowdingDistance attributes for
its solutions. |
|
NondominatedSortingPopulation(Iterable<? extends Solution> iterable)
Constructs a population initialized with the specified solutions that maintains the rank and crowdingDistance attributes for
its solutions. |
|
| Method Summary | |
|---|---|
boolean |
add(Solution solution)
Adds the specified solution to this population. |
void |
clear()
Removes all solutions from this population. |
Solution |
get(int index)
Returns the solution at the specified index in this population. |
Iterator<Solution> |
iterator()
Returns an iterator for accessing the solutions in this population. |
void |
prune(int size)
Prunes the population to the specified size. |
void |
remove(int index)
Removes the solution at the specified index from this population. |
boolean |
remove(Solution solution)
Removes the specified solution from this population, if present. |
void |
sort(Comparator<? super Solution> comparator)
Sorts the solutions in this population using the specified comparator. |
void |
truncate(int size)
Equivalent to calling truncate(size,
new NondominatedSortingComparator()). |
void |
truncate(int size,
Comparator<? super Solution> comparator)
Sorts this population using the specified comparator and removes the last (maximum) solutions until this population's size is within the specified size. |
void |
update()
Updates the rank and crowding distance of all solutions in this population. |
| Methods inherited from class org.moeaframework.core.Population |
|---|
addAll, addAll, contains, containsAll, containsAll, indexOf, isEmpty, removeAll, removeAll, size |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NondominatedSortingPopulation()
rank and
crowdingDistance attributes for its solutions.
public NondominatedSortingPopulation(DominanceComparator comparator)
rank and
crowdingDistance attributes for its solutions.
comparator - the dominance comparator
public NondominatedSortingPopulation(DominanceComparator comparator,
Iterable<? extends Solution> iterable)
rank and crowdingDistance attributes for
its solutions.
comparator - the dominance comparatoriterable - the solutions used to initialize this populationpublic NondominatedSortingPopulation(Iterable<? extends Solution> iterable)
rank and crowdingDistance attributes for
its solutions.
iterable - the solutions used to initialize this population| Method Detail |
|---|
public boolean add(Solution solution)
Population
add in class Populationsolution - the solution to be added
true if the population was modified as a result of this
method; false otherwise.public Solution get(int index)
Population
get in class Populationindex - the index of the solution to be returned
public void remove(int index)
Population
remove in class Populationindex - the index of the solution to be removedpublic boolean remove(Solution solution)
Population
remove in class Populationsolution - the solution to be removed
true if this population was modified as a result of this
method; false otherwisepublic void clear()
Population
clear in class Populationpublic Iterator<Solution> iterator()
Population
iterator in interface Iterable<Solution>iterator in class Populationpublic void sort(Comparator<? super Solution> comparator)
Populationget, remove and iteration methods
should be called immediately after invoking this method.
sort in class Populationcomparator - the comparator to be used for sorting
public void truncate(int size,
Comparator<? super Solution> comparator)
Population
truncate in class Populationsize - the target population size after truncationcomparator - the comparator to be used for truncationpublic void truncate(int size)
truncate(size,
new NondominatedSortingComparator()).
size - the target population size after truncationpublic void prune(int size)
truncate(int), except the crowding distance is recalculated
each time a solution is removed.
size - the target population size after pruningpublic void update()
update() manually.
|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||