Parametrization of OCP during initialization

Hi All,

We are using acados to generate OCPs where we need fairly large tables as part of the problem formulation. We also require the ability to parameterize the OCP with the table data, but here we run into some rather annoying limitations.

In casadi we can represent the table data as a spline, either using the interpolant function or the Bspline function directly.

The interpolant function automatically calculates the BSpline coefficients from the table data but as our tables have mutliple dimensions and are quite large this can take several minutes. We can specify this function with the table data being MX symbols and parameterize the OCP in the standard acados manner. Unfortunately acados assumes that the whole parameter vector can change for each OCP solve and the spline fitting is therefore performed at each time-step. This method is therefore not suitable for a real-time implementation.

Using the bspline function in casadi we can specify the spline coefficients directly, but this casadi function does not support that the coefficients are MX symbols and as a result we cannot parameterize the OCP using pre-computed coefficients.

We are therefore looking into two different solution.

  1. An alternative Bspline implementation where we can specify the coefficients as MX parameters
  2. Some way of specifying parameters which cannot change once the OCP has been initialized. In this way we could perform the spline fitting only once when the OCP is first initialized.

Does anyone have experience solving a similar problem or maybe some idea on how we most efficiently can solve this problem?

Hi Jacob,

I think it is closely related to this post:

Unfortunately, I do not have much experience with CasADi splines.
If you find a good workflow, I would be very interested!


It is a similar problem but there are slight differences:

  • We can fix the size of the splines at compile-time
  • We do not need to change the spline once the OCP has been initialized

Worst case is that we have to create our own spline functions from scratch, and that will definitely take some time to get right.