Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmin_powell can fail for out-of-bounds initial guess #159

Open
mmckerns opened this issue Nov 19, 2021 · 0 comments
Open

fmin_powell can fail for out-of-bounds initial guess #159

mmckerns opened this issue Nov 19, 2021 · 0 comments

Comments

@mmckerns
Copy link
Member

>>> import mystic as my
>>> import mystic.models as mm
>>> rosen = mm.rosen
>>> bounds = [(0.0001, 0.0002)]*3
>>> _eqn = 'x0 + x1 + x2 <= .0005'
>>> eqn = my.symbolic.simplify(_eqn)
>>> cons = my.symbolic.generate_constraint(my.symbolic.generate_solvers(eqn), join=my.constraints.and_)
>>> guess = [0.001,0.001,0.001]
>>> tight = None
>>> solution = my.solvers.fmin_powell(rosen, guess, maxiter=50, bounds=bounds, constraints=cons, tight=tight)
/Users/mmckerns/lib/python3.7/site-packages/mystic-0.3.9.dev0-py3.7.egg/mystic/scipy_optimize.py:655: RuntimeWarning: invalid value encountered in subtract
  if (fx2 - fval) > delta:
/Users/mmckerns/lib/python3.7/site-packages/mystic-0.3.9.dev0-py3.7.egg/mystic/scipy_optimize.py:700: RuntimeWarning: invalid value encountered in subtract
  if (fx2 - fval) > delta:
Optimization terminated successfully.
         Current function value: inf
         Iterations: 2
         Function evaluations: 0
>>> print(solution)
[-10.35161585   5.17605792   5.17605792]

For the same problem, other solvers perform much better -- and at least don't fail to produce a single good result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant