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
Modifier and TypeFieldDescriptionprotected final double
The epsilon or numerical precision of this constraint.protected final double
The lower bound of this constraint.protected final double
The upper bound of this constraint.Fields inherited from class org.moeaframework.core.constraint.AbstractConstraint
name, value
-
Constructor Summary
ConstructorDescriptionBoundedConstraint
(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 TypeMethodDescriptionboolean
Returns the string representation, or definition, of this object.double
Returns the epsilon or numerical precision of this constraint.double
getLower()
Returns the lower bound of this constraint.double
getUpper()
Returns the upper bound of this constraint.int
hashCode()
toString()
Methods inherited from class org.moeaframework.core.constraint.AbstractConstraint
getName, getValue, setValue
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:Defined
Returns the string representation, or definition, of this object.- Returns:
- the definition
-
toString
- Overrides:
toString
in classAbstractConstraint
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractConstraint
-
equals
- Overrides:
equals
in classAbstractConstraint
-