Package org.uma.jmetal.util
Class ConstraintHandling
java.lang.Object
org.uma.jmetal.util.ConstraintHandling
This class offers a set of static methods for setting and getting information about constraints
in solutions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe computing of the constraints can be precomputed when evaluating a solution. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Solution<?>>
doublefeasibilityRatio(List<S> solutions) Returns the ratio of feasible solutions in a solution liststatic <S extends Solution<?>>
booleanisFeasible(S solution) Given a solution, it is feasible if the number of violated constraints is zerostatic <S extends Solution<?>>
intnumberOfViolatedConstraints(S solution) Returns the number of constraints a solution violates.static <S extends Solution<?>>
voidnumberOfViolatedConstraints(S solution, int numberOfViolatedConstraints) Sets the number of violated constraints in a solutionstatic <S extends Solution<?>>
doubleoverallConstraintViolationDegree(S solution) Returns the overall constraint violation degree of a solution.static <S extends Solution<?>>
voidoverallConstraintViolationDegree(S solution, double constraintViolationDegreeValue) Sets the overall constraint violation degree of a solution
-
Constructor Details
-
ConstraintHandling
public ConstraintHandling()
-
-
Method Details
-
isFeasible
Given a solution, it is feasible if the number of violated constraints is zero- Type Parameters:
S-- Parameters:
solution-- Returns:
-
numberOfViolatedConstraints
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
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
-