Skip to content

Commit

Permalink
Merge pull request #376 from Chang-SHAO/main
Browse files Browse the repository at this point in the history
Update powell.py
  • Loading branch information
Evolutionary-Intelligence authored Jul 3, 2024
2 parents b3042ec + 28a53cf commit 51e7e88
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pypop7/optimizers/ds/powell.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def _minimize_scalar_bounded(func, bounds,
def _line_for_search(x0, alpha, lb, ub):
# this is adopted from https://github.com/scipy/scipy/blob/main/scipy/optimize/_optimize.py
nonzero, = alpha.nonzero()
if len(nonzero) == 0:
return (0, 0)

lb, ub = lb[nonzero], ub[nonzero]
x0, alpha = x0[nonzero], alpha[nonzero]
low, high = (lb - x0)/alpha, (ub - x0)/alpha
Expand Down

0 comments on commit 51e7e88

Please sign in to comment.