Skip to content

Commit

Permalink
Merge pull request #13804 from WarrenWeckesser/doc-bounds
Browse files Browse the repository at this point in the history
DOC+MAINT: optimize: lb and ub in the Bounds constructor are not optional
  • Loading branch information
mdhaber committed Apr 5, 2021
2 parents ac23f85 + e199019 commit 04e9644
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scipy/optimize/_constraints.py
Expand Up @@ -166,7 +166,7 @@ class Bounds:
Parameters
----------
lb, ub : array_like, optional
lb, ub : array_like
Lower and upper bounds on independent variables. Each array must
have the same size as x or be a scalar, in which case a bound will be
the same for all the variables. Set components of `lb` and `ub` equal
Expand All @@ -185,10 +185,12 @@ def __init__(self, lb, ub, keep_feasible=False):
self.keep_feasible = keep_feasible

def __repr__(self):
start = f"{type(self).__name__}({self.lb!r}, {self.ub!r}"
if np.any(self.keep_feasible):
return "{}({!r}, {!r}, keep_feasible={!r})".format(type(self).__name__, self.lb, self.ub, self.keep_feasible)
end = f", keep_feasible={self.keep_feasible!r})"
else:
return "{}({!r}, {!r})".format(type(self).__name__, self.lb, self.ub)
end = ")"
return start + end


class PreparedConstraint:
Expand Down

0 comments on commit 04e9644

Please sign in to comment.