Skip to content

Commit eba4ff5

Browse files
committed
Fix a bug occuring when constraints of type int are used.
1 parent baf10da commit eba4ff5

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

bayes_opt/constraint.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,8 @@ class ConstraintModel():
4040
def __init__(self, fun, lb, ub, random_state=None):
4141
self.fun = fun
4242

43-
if isinstance(lb, float):
44-
self._lb = np.array([lb])
45-
else:
46-
self._lb = lb
47-
48-
if isinstance(ub, float):
49-
self._ub = np.array([ub])
50-
else:
51-
self._ub = ub
43+
self._lb = np.atleast_1d(lb)
44+
self._ub = np.atleast_1d(ub)
5245

5346
if np.any(self._lb >= self._ub):
5447
msg = "Lower bounds must be less than upper bounds."

0 commit comments

Comments
 (0)