Hessian quality requirements for External cost?

Hi.

What are the requirements to the Hessian supplied as part of the external cost function, e.g. https://github.com/acados/acados/blob/master/examples/c/no_interface_examples/mass_spring_nmpc_example.c#L158-L262

I am currently experimenting with some external costs for a simple kinematic bicycle model and I am struggling with convergence.
I keep running into QP errors such as MIN STEP or MAXIMUM ITERATIONS.
Sometimes it help to set the regularization mode to project instead of no_regularize.

Can you shed some light on this? What are the requirements to the supplied Hessian? Is it likely to be the Hessian causing the observed QP errors if it is not smooth although it is continuously defined for all values in a small neighborhood?
Is it possible to avoid providing the Hessian and instead approximate it with BFGS?

Best regards
Thomas Jespersen

Hi Thomas,

Most of the OCP SQP theory only holds for twice continuously differentiable problem functions.
But there can definitely be other issues.

Sometimes it help to set the regularization mode to project instead of no_regularize.

Did you also try convexify, I had the best experience with this regularization.

Unfortunately, BFGS is not implemented in acados (yet).
You can only use Gauss-Newton Hessian approximation or exact.
You can also selectively turn on/off the exact hessian contributions of cost, constraint and dynamics modules.

Best,
Jonathan