Class ThresholdConstraint
java.lang.Object
org.moeaframework.core.constraint.AbstractConstraint
org.moeaframework.core.constraint.ThresholdConstraint
- All Implemented Interfaces:
Serializable,Comparable<Constraint>,Constraint,Copyable<Constraint>,Defined,Named
- Direct Known Subclasses:
Equal,GreaterThan,GreaterThanOrEqual,LessThan,LessThanOrEqual,NotEqual
Abstract class for constraints of the form
<value> <op> <threshold>. To handle numerical precision when
comparing floating-point values, a small epsilon difference is permitted, which by default is Settings.EPS.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.moeaframework.core.Defined
Defined.ConstructorComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final doubleThe epsilon or numerical precision of this constraint.protected final doubleThe threshold value for this constraint.Fields inherited from class org.moeaframework.core.constraint.AbstractConstraint
name, value -
Constructor Summary
ConstructorsConstructorDescriptionThresholdConstraint(double threhsold) Constructs a new threshold constraint.ThresholdConstraint(double threshold, double epsilon) Constructs a new threshold constraint.ThresholdConstraint(String name, double threhsold) Constructs a new threshold constraint.ThresholdConstraint(String name, double threshold, double epsilon) Constructs a new threshold constraint.Constructs a copy of a threshold constraint. -
Method Summary
Methods inherited from class org.moeaframework.core.constraint.AbstractConstraint
getName, getValue, setValueMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.moeaframework.core.constraint.Constraint
compareTo, getMagnitudeOfViolation, isViolation, withValue
-
Field Details
-
threshold
protected final double thresholdThe threshold value for this constraint. -
epsilon
protected final double epsilonThe epsilon or numerical precision of this constraint.
-
-
Constructor Details
-
ThresholdConstraint
public ThresholdConstraint(double threhsold) Constructs a new threshold constraint.- Parameters:
threhsold- the threshold value
-
ThresholdConstraint
public ThresholdConstraint(double threshold, double epsilon) Constructs a new threshold constraint.- Parameters:
threshold- the threshold valueepsilon- the epsilon value
-
ThresholdConstraint
Constructs a new threshold constraint.- Parameters:
name- the namethrehsold- the threshold value
-
ThresholdConstraint
Constructs a new threshold constraint.- Parameters:
name- the namethreshold- the threshold valueepsilon- the epsilon value
-
ThresholdConstraint
Constructs a copy of a threshold constraint.- Parameters:
copy- the copy
-
-
Method Details
-
getThreshold
public double getThreshold()Returns the threshold value.- Returns:
- the threshold value
-
getEpsilon
public double getEpsilon()Returns the epsilon value used for numeric precision.- Returns:
- the epsilon value
-
getDefinition
Description copied from interface:DefinedReturns the string representation, or definition, of this object.- Returns:
- the definition
-
toString
- Overrides:
toStringin classAbstractConstraint
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractConstraint
-
equals
- Overrides:
equalsin classAbstractConstraint
-