Skip to content

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

@mmckerns

Description

@mmckerns
>>> 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions