Class ConstraintHandling

java.lang.Object
org.uma.jmetal.util.ConstraintHandling

public class ConstraintHandling extends Object
This class offers a set of static methods for setting and getting information about constraints in solutions.
  • Constructor Details

    • ConstraintHandling

      public ConstraintHandling()
  • Method Details

    • isFeasible

      public static <S extends Solution<?>> boolean isFeasible(S solution)
      Given a solution, it is feasible if the number of violated constraints is zero
      Type Parameters:
      S -
      Parameters:
      solution -
      Returns:
    • numberOfViolatedConstraints

      public static <S extends Solution<?>> int numberOfViolatedConstraints(S solution)
      Returns the number of constraints a solution violates. A check is made to determine whether that number has been precomputed; if not, it is calculated as the sum of the constraints having a negative value.
      Type Parameters:
      S -
      Parameters:
      solution -
      Returns:
    • overallConstraintViolationDegree

      public static <S extends Solution<?>> void overallConstraintViolationDegree(S solution, double constraintViolationDegreeValue)
      Sets the overall constraint violation degree of a solution
      Type Parameters:
      S -
      Parameters:
      solution -
      constraintViolationDegreeValue -
    • numberOfViolatedConstraints

      public static <S extends Solution<?>> void numberOfViolatedConstraints(S solution, int numberOfViolatedConstraints)
      Sets the number of violated constraints in a solution
      Type Parameters:
      S -
      Parameters:
      solution -
      numberOfViolatedConstraints -
    • overallConstraintViolationDegree

      public static <S extends Solution<?>> double overallConstraintViolationDegree(S solution)
      Returns the overall constraint violation degree of a solution. A check is made to determine whether that number has been precomputed; if not, it is calculated as the sum of the values of the constraints having a negative value.
      Type Parameters:
      S -
      Parameters:
      solution -
      Returns:
    • feasibilityRatio

      public static <S extends Solution<?>> double feasibilityRatio(List<S> solutions)
      Returns the ratio of feasible solutions in a solution list
      Parameters:
      solutions -
      Returns: