Skip to content

SciPy Backend

The SciPy backend is included in the base package. It uses SciPy's trust-constr optimizer and does not require Ipopt:

conda create -n pockit -c conda-forge pockit
conda activate pockit

If conda is unavailable, install the PyPI distribution instead:

python -m pip install pockit-optimal-control

Select the backend explicitly:

from pockit.optimizer import scipy

solution, result = scipy.solve(
    system,
    guess,
    optimizer_options={"maxiter": 1000, "verbose": 1},
)
if not result.success:
    raise RuntimeError(result.message)

The SciPy backend is well suited to installation verification, teaching examples, and moderately sized nonlinear programs. Ipopt generally scales better for large, sparse constrained problems produced by fine optimal-control meshes. Actual performance still depends on the model, scaling, derivatives, and initial guess. See Quick Installation when Ipopt is needed.

The backend accepts the options and returns the result object defined by scipy.optimize.minimize with method="trust-constr". These differ from Ipopt's options and status dictionary.