Class BoundedConstraint
java.lang.Object
org.moeaframework.core.constraint.AbstractConstraint
org.moeaframework.core.constraint.BoundedConstraint
- All Implemented Interfaces:
Serializable,Comparable<Constraint>,Constraint,Copyable<Constraint>,Defined,Named
Abstract class for bounded constraints of the form
<lower> <op> <value> <op> <upper>. 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 lower bound of this constraint.protected final doubleThe upper bound of this constraint.Fields inherited from class org.moeaframework.core.constraint.AbstractConstraint
name, value -
Constructor Summary
ConstructorsConstructorDescriptionBoundedConstraint(double lower, double upper) Constructs a new bounded constraint.BoundedConstraint(double lower, double upper, double epsilon) Constructs a new bounded constraint.BoundedConstraint(String name, double lower, double upper) Constructs a new bounded constraint.BoundedConstraint(String name, double lower, double upper, double epsilon) Constructs a new bounded constraint.Constructs a copy of a bounded constraint. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the string representation, or definition, of this object.doubleReturns the epsilon or numerical precision of this constraint.doublegetLower()Returns the lower bound of this constraint.doublegetUpper()Returns the upper bound of this constraint.inthashCode()toString()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
-
lower
protected final double lowerThe lower bound of this constraint. -
upper
protected final double upperThe upper bound of this constraint. -
epsilon
protected final double epsilonThe epsilon or numerical precision of this constraint.
-
-
Constructor Details
-
BoundedConstraint
public BoundedConstraint(double lower, double upper) Constructs a new bounded constraint.- Parameters:
lower- the lower thresholdupper- the upper threshold
-
BoundedConstraint
public BoundedConstraint(double lower, double upper, double epsilon) Constructs a new bounded constraint.- Parameters:
lower- the lower thresholdupper- the upper thresholdepsilon- the epsilon value
-
BoundedConstraint
Constructs a new bounded constraint.- Parameters:
name- the namelower- the lower thresholdupper- the upper threshold
-
BoundedConstraint
Constructs a new bounded constraint.- Parameters:
name- the namelower- the lower thresholdupper- the upper thresholdepsilon- the epsilon value
-
BoundedConstraint
Constructs a copy of a bounded constraint.- Parameters:
copy- the constraint to copy
-
-
Method Details
-
getLower
public double getLower()Returns the lower bound of this constraint.- Returns:
- the lower bound
-
getUpper
public double getUpper()Returns the upper bound of this constraint.- Returns:
- the upper bound
-
getEpsilon
public double getEpsilon()Returns the epsilon or numerical precision of this constraint.- 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
-