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 functionf
but the Hessian of the LagrangianL(x) = obj_factor * f(x) + lagrange * g(x)
, whereg
is the constraint residuals.The argument
constraints
is mandatory. It is also not a list as in usual scipy optimize methods, but a singleConstraint
instance.
If you are looking for a solution whose API is closer to the usual scipy interface, have a look at cyipopt.