Class BoxConstraints


  • public class BoxConstraints
    extends Object
    This represents the lower and upper bounds for a variable.
     lb ≤ x ≤ ub
     
    • Constructor Detail

      • BoxConstraints

        public BoxConstraints​(int dim,
                              BoxConstraints.Bound... bounds)
        Construct a set of bound constraints.
        Parameters:
        bounds - the bounds
        dim - the number of variables
      • BoxConstraints

        public BoxConstraints​(Vector lower,
                              Vector upper)
        Construct a set of bound constraints.
        Parameters:
        lower - the lower bound values
        upper - the upper bound values
    • Method Detail

      • lowerBounds

        public Vector lowerBounds()
        Gets the lower bounds.
        Returns:
        the lower bounds
      • upperBounds

        public Vector upperBounds()
        Gets the upper bounds.
        Returns:
        the upper bounds
      • upperBoundConstraints

        public LinearLessThanConstraints upperBoundConstraints()
        Split the box constraints and get the less-than-the-upper-bounds part.
        Returns:
        the upper bound constraints
      • lowerBoundConstraints

        public LinearGreaterThanConstraints lowerBoundConstraints()
        Split the box constraints and get the greater-than-the-lower-bounds part.
        Returns:
        the lower bound constraints
      • isInBox

        public static boolean isInBox​(Vector x,
                                      Vector lower,
                                      Vector upper)
        Check if a solution is within a box.
        Parameters:
        x - a solution
        lower - lower bounds
        upper - upper bounds
        Returns:
        true if x is in the box