## Class Pareto

• ```public final class Pareto
extends Object```
Low-level utility methods for doing pareto-optimal calculations. This methods are mostly for users who wants to extend the existing MOEA classes.
Since:
4.1
Version:
4.1
• ### Method Summary

All Methods
Modifier and Type Method Description
`static <T> double[]` `crowdingDistance​(BaseSeq<? extends Vec<T>> set)`
The crowding distance value of a solution provides an estimate of the density of solutions surrounding that solution.
`static <T> double[]` ```crowdingDistance​(BaseSeq<? extends T> set, ElementComparator<? super T> comparator, ElementDistance<? super T> distance, ToIntFunction<? super T> dimension)```
The crowding distance value of a solution provides an estimate of the density of solutions surrounding that solution.
`static int` ```dominance​(double[] u, double[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
`static int` ```dominance​(int[] u, int[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
`static int` ```dominance​(long[] u, long[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
`static <C extends Comparable<? super C>>int` ```dominance​(C[] u, C[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
`static <T> int` ```dominance​(T[] u, T[] v, Comparator<? super T> comparator)```
Calculates the Pareto Dominance of the two vectors u and v.
`static <V> int` ```dominance​(V u, V v, int dimensions, ElementComparator<? super V> comparator)```
Calculates the Pareto Dominance of the two vectors u and v.
`static <T> ISeq<Vec<T>>` `front​(BaseSeq<? extends Vec<T>> set)`
Return the elements, from the given input `set`, which are part of the pareto front.
`static <T> ISeq<T>` ```front​(BaseSeq<? extends T> set, Comparator<? super T> dominance)```
Return the elements, from the given input `set`, which are part of the pareto front.
`static <T> int[]` `rank​(BaseSeq<? extends Vec<T>> set)`
Calculates the non-domination rank of the given input `set`, using the natural order of the elements as dominance measure.
`static <T> int[]` ```rank​(BaseSeq<? extends T> set, Comparator<? super T> dominance)```
Calculates the non-domination rank of the given input `set`, using the given `dominance` comparator.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

• #### crowdingDistance

`public static <T> double[] crowdingDistance​(BaseSeq<? extends Vec<T>> set)`
The crowding distance value of a solution provides an estimate of the density of solutions surrounding that solution. The crowding distance value of a particular solution is the average distance of its two neighboring solutions.
Type Parameters:
`T` - the vector type
Parameters:
`set` - the point set used for calculating the crowding distance
Returns:
the crowded distances of the `set` points
Throws:
`NullPointerException` - if the input `set` is `null`
`IllegalArgumentException` - if `set.get(0).length() < 2`
`crowdingDistance(BaseSeq, ElementComparator, ElementDistance, ToIntFunction)`
API Note:
Calculating the crowding distance has a time complexity of `O(d*n*log(n))`, where `d` is the number of dimensions and `n` the `set` size.
• #### crowdingDistance

```public static <T> double[] crowdingDistance​(BaseSeq<? extends T> set,
ElementComparator<? super T> comparator,
ElementDistance<? super T> distance,
ToIntFunction<? super T> dimension)```
The crowding distance value of a solution provides an estimate of the density of solutions surrounding that solution. The crowding distance value of a particular solution is the average distance of its two neighboring solutions.
Type Parameters:
`T` - the vector type
Parameters:
`set` - the point set used for calculating the crowding distance
`comparator` - the comparator which defines the (total) order of the vector elements of `T`
`distance` - the distance of two vector elements
`dimension` - the dimension of vector type `T`
Returns:
the crowded distances of the `set` points
Throws:
`NullPointerException` - if one of the arguments is `null`
`crowdingDistance(BaseSeq)`
API Note:
Calculating the crowding distance has a time complexity of `O(d*n*log(n))`, where `d` is the number of dimensions and `n` the `set` size.
• #### rank

`public static <T> int[] rank​(BaseSeq<? extends Vec<T>> set)`
Calculates the non-domination rank of the given input `set`, using the natural order of the elements as dominance measure.
Type Parameters:
`T` - the element type
Parameters:
`set` - the input set
Returns:
the non-domination rank of the given input `set`
API Note:
Calculating the rank has a time complexity of `O(n^2`, where `n` the `set` size.

Reference: Kalyanmoy Deb, Associate Member, IEEE, Amrit Pratap, Sameer Agarwal, and T. Meyarivan. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II, IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 6, NO. 2, APRIL 2002.

• #### rank

```public static <T> int[] rank​(BaseSeq<? extends T> set,
Comparator<? super T> dominance)```
Calculates the non-domination rank of the given input `set`, using the given `dominance` comparator.
Type Parameters:
`T` - the element type
Parameters:
`set` - the input set
`dominance` - the dominance comparator used
Returns:
the non-domination rank of the given input `set`
API Note:
Calculating the rank has a time and space complexity of `O(n^2`, where `n` the `set` size.

Reference: Kalyanmoy Deb, Associate Member, IEEE, Amrit Pratap, Sameer Agarwal, and T. Meyarivan. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II, IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 6, NO. 2, APRIL 2002.

• #### front

`public static <T> ISeq<Vec<T>> front​(BaseSeq<? extends Vec<T>> set)`
Return the elements, from the given input `set`, which are part of the pareto front. The `Comparable` interface defines the dominance measure of the elements, used for calculating the pareto front.

Reference: E. Zitzler and L. Thiele. Multiobjective Evolutionary Algorithms: A Comparative Case Study and the Strength Pareto Approach, IEEE Transactions on Evolutionary Computation, vol. 3, no. 4, pp. 257-271, 1999.

Type Parameters:
`T` - the element type
Parameters:
`set` - the input set
Returns:
the elements which are part of the pareto set
Throws:
`NullPointerException` - if one of the arguments is `null`
• #### front

```public static <T> ISeq<T> front​(BaseSeq<? extends T> set,
Comparator<? super T> dominance)```
Return the elements, from the given input `set`, which are part of the pareto front.

Reference: E. Zitzler and L. Thiele. Multiobjective Evolutionary Algorithms: A Comparative Case Study and the Strength Pareto Approach, IEEE Transactions on Evolutionary Computation, vol. 3, no. 4, pp. 257-271, 1999.

Type Parameters:
`T` - the element type
Parameters:
`set` - the input set
`dominance` - the dominance comparator used
Returns:
the elements which are part of the pareto set
Throws:
`NullPointerException` - if one of the arguments is `null`
• #### dominance

```public static <C extends Comparable<? super C>> int dominance​(C[] u,
C[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
Type Parameters:
`C` - the element type of vector u and v
Parameters:
`u` - the first vector
`v` - the second vector
Returns:
`1` if uv, `-1` if vu and `0` otherwise
Throws:
`NullPointerException` - if one of the arguments is `null`
`IllegalArgumentException` - if `u.length != v.length`
`Vec.dominance(Comparable[], Comparable[])`
• #### dominance

```public static <T> int dominance​(T[] u,
T[] v,
Comparator<? super T> comparator)```
Calculates the Pareto Dominance of the two vectors u and v.
Type Parameters:
`T` - the element type of vector u and v
Parameters:
`u` - the first vector
`v` - the second vector
`comparator` - the element comparator which is used for calculating the dominance
Returns:
`1` if uv, `-1` if vu and `0` otherwise
Throws:
`NullPointerException` - if one of the arguments is `null`
`IllegalArgumentException` - if `u.length != v.length`
`Vec.dominance(Object[], Object[], Comparator)`
• #### dominance

```public static int dominance​(int[] u,
int[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
Parameters:
`u` - the first vector
`v` - the second vector
Returns:
`1` if uv, `-1` if vu and `0` otherwise
Throws:
`NullPointerException` - if one of the arguments is `null`
`IllegalArgumentException` - if `u.length != v.length`
`Vec.dominance(int[], int[])`
• #### dominance

```public static int dominance​(long[] u,
long[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
Parameters:
`u` - the first vector
`v` - the second vector
Returns:
`1` if uv, `-1` if vu and `0` otherwise
Throws:
`NullPointerException` - if one of the arguments is `null`
`IllegalArgumentException` - if `u.length != v.length`
`Vec.dominance(long[], long[])`
• #### dominance

```public static int dominance​(double[] u,
double[] v)```
Calculates the Pareto Dominance of the two vectors u and v.
Parameters:
`u` - the first vector
`v` - the second vector
Returns:
`1` if uv, `-1` if vu and `0` otherwise
Throws:
`NullPointerException` - if one of the arguments is `null`
`IllegalArgumentException` - if `u.length != v.length`
`Vec.dominance(double[], double[])`
• #### dominance

```public static <V> int dominance​(V u,
V v,
int dimensions,
ElementComparator<? super V> comparator)```
Calculates the Pareto Dominance of the two vectors u and v.
Type Parameters:
`V` - the vector type
Parameters:
`u` - the first vector
`v` - the second vector
`dimensions` - the number of vector elements
`comparator` - the comparator used for comparing the vector elements
Returns:
`1` if uv, `-1` if vu and `0` otherwise
Throws:
`NullPointerException` - if one of the arguments is `null`
Since:
5.2