Skip to content

Commit

Permalink
GradientOptimization: fix error on default bounds
Browse files Browse the repository at this point in the history
bounds are checked only during reset, and the default value of
search_space causes this to fail (lower == upper)
  • Loading branch information
kmantel committed Jan 27, 2023
1 parent e6638bb commit 93b5411
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,9 @@ def reset(self, default_variable=None, objective_function=None, context=None, **
# Array specified for upper bound, so replace any None's with +inf
upper = np.array([[float('inf')] if n[0] is None else n for n in upper.reshape(sample_len,1)])

if not all(lower<upper):
if not all(lower <= upper):
raise OptimizationFunctionError(f"Specification of {repr(BOUNDS)} arg ({bounds}) for {self.name}"
f"{owner_str} resulted in lower >= corresponding upper for one or "
f"{owner_str} resulted in lower > corresponding upper for one or "
f"more elements (lower: {lower.tolist()}; uuper: {upper.tolist()}).")

bounds = (lower,upper)
Expand Down

0 comments on commit 93b5411

Please sign in to comment.