Package org.moeaframework.core.attribute
Class Penalty
java.lang.Object
org.moeaframework.core.attribute.Penalty
- All Implemented Interfaces:
Attribute
Penalty attribute. This is used by penalty functions to penalize solutions that violate constraints.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic final doublegetAttribute(Solution solution) Returns the value of the attribute stored in the solution.static final booleanhasAttribute(Solution solution) Returnstrueif the solution defines this attribute;falseotherwise.static final voidsetAttribute(Solution solution, double value) Sets the value of the attribute on the solution.
-
Field Details
-
ATTRIBUTE_NAME
The name / key used for this attribute.- See Also:
-
-
Method Details
-
hasAttribute
Returnstrueif the solution defines this attribute;falseotherwise.- Parameters:
solution- the solution- Returns:
trueif the solution defines this attribute;falseotherwise
-
setAttribute
Sets the value of the attribute on the solution.- Parameters:
solution- the solutionvalue- the value to set
-
getAttribute
Returns the value of the attribute stored in the solution.- Parameters:
solution- the solution- Returns:
- the stored value
-