scipy optimize method

ipyopt also comes with a ipopt method for `scipy.optimize.minimize`_:

result = scipy.optimize.minimize(
    fun=...,
    x0=...,
    jac=...,
    constraints=...,
    method=ipyopt.optimize.ipopt,
    ...
    )

Warning

The ipopt method differs in some points from the standard scipy methods:

  • The argument jac is mandatory (explicitly use `scipy.optimize.approx_fprime`_ if you want to numerically approximate it or see Automatic symbolic derivatives / code generation on how to auto differentiate symbolic expressions)

  • hess is not the Hessian of the objective function f but the Hessian of the Lagrangian L(x) = obj_factor * f(x) + lagrange * g(x), where g is the constraint residuals.

  • The argument constraints is mandatory. It is also not a list as in usual scipy optimize methods, but a single Constraint instance.

If you are looking for a solution whose API is closer to the usual scipy interface, have a look at cyipopt.

Module optimize