Class Rank

java.lang.Object
org.moeaframework.core.attribute.Rank
All Implemented Interfaces:
Attribute

public final class Rank extends Object implements Attribute
The rank of the solution. The rank is typically computed by non-dominated sorting, where a value of 0 indicates the solution belongs to the Pareto non-dominated front, and values > 0 indicate each successive Pareto front.
  • Field Details

    • ATTRIBUTE_NAME

      public static final String ATTRIBUTE_NAME
      The name / key used for this attribute.
      See Also:
    • BEST_RANK

      public static final int BEST_RANK
      Constant identifying the value of the best rank (aka. the Pareto front).
      See Also:
  • Method Details

    • hasAttribute

      public static final boolean hasAttribute(Solution solution)
      Returns true if the solution defines this attribute; false otherwise.
      Parameters:
      solution - the solution
      Returns:
      true if the solution defines this attribute; false otherwise
    • setAttribute

      public static final void setAttribute(Solution solution, int value)
      Sets the value of the attribute on the solution.
      Parameters:
      solution - the solution
      value - the value to set
    • getAttribute

      public static final int getAttribute(Solution solution)
      Returns the value of the attribute stored in the solution.
      Parameters:
      solution - the solution
      Returns:
      the stored value
    • isRank

      public static final Predicate<Solution> isRank(int rank)
      Returns a predicate for identifying solutions belonging to a specific rank.
      Parameters:
      rank - the rank
      Returns:
      the predicate function