Scipy.optimize: how to restrict argument values

后端 未结 4 844
星月不相逢
星月不相逢 2020-12-13 18:40

I\'m trying to use scipy.optimize functions to find a global minimum of a complicated function with several arguments. scipy.optimize.minimize seem

4条回答
  •  渐次进展
    2020-12-13 19:25

    The Nelder-Mead solver doesn't support constrained optimization, but there are several others that do.

    TNC and L-BFGS-B both support only bound constraints (e.g. x[0] >= 0), which should be fine for your case. COBYLA and SLSQP are more flexible, supporting any combination of bounds, equality and inequality-based constraints.

    You can find more detailed info about the solvers by looking at the docs for the standalone functions, e.g. scipy.optimize.fmin_slsqp for method='SLSQP'.

    You can see my previous answer here for an example of constrained optimization using SLSQP.

提交回复
热议问题