giaf / hpipm

High-performance interior-point-method QP and QCQP solvers
Other
552 stars 130 forks source link

Termination condition based on the duality gap #171

Open stephane-caron opened 1 month ago

stephane-caron commented 1 month ago

Following up to your proposal in https://github.com/qpsolvers/mpc_qpbenchmark/discussions/7#discussioncomment-10673601:

Currently HPIPM does not support a termination criterion based on duality gap, but this could be easily added if requested.

Could HPIPM provide an interface for termination based on the duality gap?

This would help evaluate it fairly alongside other solvers in qpbenchmark#122. I could then help update the corresponding interface and benchmark code, and of course re-run the benchmarking test sets afterwards.

giaf commented 3 weeks ago

For dense and OCP QPs I added the computation of the duality gap at each IPM iteration, and exit condition based on a duality gap tolerance (tol_dual_gap, that by default is set to 1.0, so effectively ignored unless explicitly set). As of now it can be used from from C https://github.com/giaf/hpipm/blob/master/dense_qp/x_dense_qp_ipm.c#L277 or from python https://github.com/giaf/hpipm/blob/master/interfaces/python/hpipm_python/hpipm_python/wrapper/hpipm_dense_qp_solver_arg.py#L82

You can try if this solves the issue with low tolerances failures in your benchmarks.