|
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
public class Population
A collection of solutions and common methods for manipulating the collection.
| Constructor Summary | |
|---|---|
Population()
Constructs an empty population. |
|
Population(Iterable<? extends Solution> iterable)
Constructs a population initialized with a collection of solutions. |
|
Population(T[] solutions)
Constructs a population initialized with an array of solutions. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(Solution solution)
Adds the specified solution to this population. |
|
boolean |
addAll(Iterable<? extends Solution> iterable)
Adds a collection of solutions to this population. |
|
|
addAll(T[] solutions)
Adds an array of solutions to this population. |
|
void |
clear()
Removes all solutions from this population. |
|
boolean |
contains(Solution solution)
Returns true if this population contains the specified solution;
false otherwise. |
|
boolean |
containsAll(Iterable<? extends Solution> iterable)
Returns true if this population contains all the solutions in the
specified collection; false otherwise. |
|
|
containsAll(T[] solutions)
Returns true if this population contains all the solutions in the
specified array; false otherwise. |
|
Solution |
get(int index)
Returns the solution at the specified index in this population. |
|
int |
indexOf(Solution solution)
Returns the index of the specified solution in this population. |
|
boolean |
isEmpty()
Returns true if this population contains no solutions;
false otherwise. |
|
Iterator<Solution> |
iterator()
Returns an iterator for accessing the solutions in this population. |
|
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. |
|
boolean |
removeAll(Iterable<? extends Solution> iterable)
Removes all solutions in the specified collection from this population. |
|
|
removeAll(T[] solutions)
Removes all solutions in the specified array from this population. |
|
int |
size()
Returns the number of solutions in this population. |
|
void |
sort(Comparator<? super Solution> comparator)
Sorts the solutions in this population using the specified comparator. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Population()
public Population(Iterable<? extends Solution> iterable)
iterable - the collection of solutions for initializing this
populationpublic Population(T[] solutions)
solutions - the array of solutions for initializing this
population| Method Detail |
|---|
public Solution get(int index)
index - the index of the solution to be returned
IndexOutOfBoundsException - if the index is out of range
(index < 0) || (index >= size())public void remove(int index)
index - the index of the solution to be removed
IndexOutOfBoundsException - if the index is out of range
(index < 0) || (index >= size())public int indexOf(Solution solution)
get or remove methods.
solution - the solution whose index is to be returned
public boolean add(Solution solution)
solution - the solution to be added
true if the population was modified as a result of this
method; false otherwise.public boolean addAll(Iterable<? extends Solution> iterable)
iterable - the collection of solutions to be added
true if the population was modified as a result of this
method; false otherwisepublic <T extends Solution> boolean addAll(T[] solutions)
solutions - the solutions to be added
true if the population was modified as a result of this
method; false otherwisepublic void clear()
public boolean contains(Solution solution)
true if this population contains the specified solution;
false otherwise.
solution - the solution whose presence is tested
true if this population contains the specified
solution; false otherwisepublic boolean containsAll(Iterable<? extends Solution> iterable)
true if this population contains all the solutions in the
specified collection; false otherwise.
iterable - the collection whose presence is tested
true if this population contains all the solutions in the
specified collection; false otherwisepublic <T extends Solution> boolean containsAll(T[] solutions)
true if this population contains all the solutions in the
specified array; false otherwise.
solutions - the array whose presence is tested
true if this population contains all the solutions in the
specified array; false otherwisepublic boolean isEmpty()
true if this population contains no solutions;
false otherwise.
true if this population contains no solutions;
false otherwise.public Iterator<Solution> iterator()
iterator in interface Iterable<Solution>public boolean remove(Solution solution)
solution - the solution to be removed
true if this population was modified as a result of this
method; false otherwisepublic boolean removeAll(Iterable<? extends Solution> iterable)
iterable - the collection of solutions to be removed
true if this population was modified as a result of this
method; false otherwisepublic <T extends Solution> boolean removeAll(T[] solutions)
solutions - the array of solutions to be removed
true if this population was modified as a result of this
method; false otherwisepublic int size()
public void sort(Comparator<? super Solution> comparator)
get, remove and iteration methods
should be called immediately after invoking this method.
comparator - the comparator to be used for sorting
public void truncate(int size,
Comparator<? super Solution> comparator)
size - the target population size after truncationcomparator - the comparator to be used for truncation
|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||