Class Between

All Implemented Interfaces:
Serializable, Comparable<Constraint>, Constraint, Copyable<Constraint>, Defined, Named

public class Between extends BoundedConstraint
The between constraint, or <lower> <= <value> <= <upper>.
See Also:
  • Constructor Details

    • Between

      public Between(double lower, double upper)
      Constructs a new between constraint.
      Parameters:
      lower - the lower threshold
      upper - the upper threshold
    • Between

      public Between(double lower, double upper, double epsilon)
      Constructs a new between constraint.
      Parameters:
      lower - the lower threshold
      upper - the upper threshold
      epsilon - the epsilon value
    • Between

      public Between(String name, double lower, double upper)
      Constructs a new between constraint.
      Parameters:
      name - the name
      lower - the lower threshold
      upper - the upper threshold
    • Between

      public Between(String name, double lower, double upper, double epsilon)
      Constructs a new between constraint.
      Parameters:
      name - the name
      lower - the lower threshold
      upper - the upper threshold
      epsilon - the epsilon value
    • Between

      public Between(Between copy)
      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, with 0.0 representing satisfied or feasible constraints. When comparing two constraints, smaller magnitudes are considered better.
      Returns:
      the magnitude of constraint violation
    • copy

      public Between copy()
      Description copied from interface: Copyable
      Creates and returns a copy of this object. It is required that x.copy() is completely independent from x. This means any method invoked on x.copy() in no way alters the state of x and vice versa. It is typically the case that x.copy().getClass() == x.getClass() and x.copy().equals(x).
      Returns:
      the copy
    • values

      public static Between values(double lower, double upper)
      Constructs a new between constraint.
      Parameters:
      lower - the lower threshold
      upper - the upper threshold
      Returns:
      the constraint
    • values

      public static Between values(double lower, double upper, double epsilon)
      Constructs a new between constraint.
      Parameters:
      lower - the lower threshold
      upper - the upper threshold
      epsilon - the epsilon value
      Returns:
      the constraint
    • values

      public static Between values(String name, double lower, double upper)
      Constructs a new between constraint.
      Parameters:
      name - the name
      lower - the lower threshold
      upper - the upper threshold
      Returns:
      the constraint
    • values

      public static Between values(String name, double lower, double upper, double epsilon)
      Constructs a new between constraint.
      Parameters:
      name - the name
      lower - the lower threshold
      upper - the upper threshold
      epsilon - the epsilon value
      Returns:
      the constraint