Class Between
java.lang.Object
org.moeaframework.core.constraint.AbstractConstraint
org.moeaframework.core.constraint.BoundedConstraint
org.moeaframework.core.constraint.Between
- All Implemented Interfaces:
Serializable
,Comparable<Constraint>
,Constraint
,Copyable<Constraint>
,Defined
,Named
The between constraint, or
<lower> <= <value> <= <upper>
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.moeaframework.core.Defined
Defined.ConstructorComparator
-
Field Summary
Fields inherited from class org.moeaframework.core.constraint.BoundedConstraint
epsilon, lower, upper
Fields inherited from class org.moeaframework.core.constraint.AbstractConstraint
name, value
-
Constructor Summary
ConstructorDescriptionBetween
(double lower, double upper) Constructs a new between constraint.Between
(double lower, double upper, double epsilon) Constructs a new between constraint.Constructs a new between constraint.Constructs a new between constraint.Constructs a copy of a between constraint. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates and returns a copy of this object.double
Returns the magnitude of constraint violation as a non-negative number, with0.0
representing satisfied or feasible constraints.static Between
values
(double lower, double upper) Constructs a new between constraint.static Between
values
(double lower, double upper, double epsilon) Constructs a new between constraint.static Between
Constructs a new between constraint.static Between
Constructs a new between constraint.Methods inherited from class org.moeaframework.core.constraint.BoundedConstraint
equals, getDefinition, getEpsilon, getLower, getUpper, 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, isViolation, withValue
-
Constructor Details
-
Between
public Between(double lower, double upper) Constructs a new between constraint.- Parameters:
lower
- the lower thresholdupper
- the upper threshold
-
Between
public Between(double lower, double upper, double epsilon) Constructs a new between constraint.- Parameters:
lower
- the lower thresholdupper
- the upper thresholdepsilon
- the epsilon value
-
Between
Constructs a new between constraint.- Parameters:
name
- the namelower
- the lower thresholdupper
- the upper threshold
-
Between
Constructs a new between constraint.- Parameters:
name
- the namelower
- the lower thresholdupper
- the upper thresholdepsilon
- the epsilon value
-
Between
Constructs a copy of a between constraint.- Parameters:
copy
- the constraint to copy
-
-
Method Details
-
getMagnitudeOfViolation
public double getMagnitudeOfViolation()Description copied from interface:Constraint
Returns the magnitude of constraint violation as a non-negative number, with0.0
representing satisfied or feasible constraints. When comparing two constraints, smaller magnitudes are considered better.- Returns:
- the magnitude of constraint violation
-
copy
Description copied from interface:Copyable
Creates and returns a copy of this object. It is required thatx.copy()
is completely independent fromx
. This means any method invoked onx.copy()
in no way alters the state ofx
and vice versa. It is typically the case thatx.copy().getClass() == x.getClass()
andx.copy().equals(x)
.- Returns:
- the copy
-
values
Constructs a new between constraint.- Parameters:
lower
- the lower thresholdupper
- the upper threshold- Returns:
- the constraint
-
values
Constructs a new between constraint.- Parameters:
lower
- the lower thresholdupper
- the upper thresholdepsilon
- the epsilon value- Returns:
- the constraint
-
values
Constructs a new between constraint.- Parameters:
name
- the namelower
- the lower thresholdupper
- the upper threshold- Returns:
- the constraint
-
values
Constructs a new between constraint.- Parameters:
name
- the namelower
- the lower thresholdupper
- the upper thresholdepsilon
- the epsilon value- Returns:
- the constraint
-