How to get the cost value of the current solution at each horizon step?

Hi :wave:

I’m using acados python and try to implement lexicographic optimization MPC.
For this, I would need the cost result of the solution for each horizon step. But as far as I know, it’s only possible to get it for the whole solution (using get_cost). Or it is?

Hi :waving_hand:

You can try to use AcadosCostConstraintEvaluator. It’s a bit of a prototype implementation though.

Easiest is just to build the stage cost function again yourself.

Best, Katrin

Hi,
Thank you for your answer.
Would you have an implementation example? I couldn’t find any documentation.

Or otherwise a way to access the function from the AcadosOcpSolver?

Best, Rémi

Here is an example using the evaluator

1 Like