Control horizon

How can I choose the control horizon from the matlab interface?
What is the value of that control horizon as default?
Thanks in advance

Hi Antonio,

if you look at this example:

There are the fields T and param_scheme_N, which are the control horizon time and the number of shooting intervals respectively.


I thought that the fields T and param_scheme_N defined the prediction horizon, not the control horizon.
From what you are saying, I suspect that the prediction and control horizon are the same as default. I am right?
Thanks in advance!!

Right, I was not really familiar with the term control horizon.
acados only supports problems where the prediction and control horizon are equal.

The case where they are not equal is just to have a long constant control in the end of the horizon as far as I understand.

This can be implemented in acados by using a nonuniform grid and setting the time between the last 2 shooting nodes larger compared to the previous ones.
In order to achieve the same integration accuracy, you could use more steps in the last integrator.

Would that work for you?

Yes, I think it will help to solve the OCP faster.

Could you show me an example of how to do that in the Matlab interface? It would be very helpful.

If I understood correctly, we have a time grid [t0,t1,t2,…tN] in which we discretize the
controls to obtain piecewise constant controls, and we use the integrator to solve the ODE in the interval [tk, tk+1] of the same grid. For that reason control horizon and prediction horizon are always the same. Isn’t it?

I suposse you refer the option sim_method_num_steps in the matlab interface. Could you explain what that option means?
I think it means that, if you have a time grid [t0,t1,t2,…tN] in which we discretize the
controls, and for example if the number of steps of the integrator is 3, in the interval [t1,t2], we have a constant piecewise control, but we solve 3 ODEs in [t1, (t1+t2)/2, t2]
Is it correct?

Thanks in advance, sorry for the inconveniences and for writing such a long question.

Sure, here e.g. acados/test_ocp_linear_mass_spring.m at 90d75386cad9f2b16115cce04685e90934c0f7d8 · acados/acados · GitHub

sim_method_num_steps, exists on each shooting interval [tk, tk+1].
The shooting interval is divided uniformly and the integration method (e.g. RK4) is applied to each of these subintervals.
IVPs are solved, not ODEs.

Note, from Matlab it is not possible yet to use different number of sim_method_num_steps for the shooting intervals. But there is a PR that adds this possibility for python: [WIP] GNRK by FreyJo · Pull Request #698 · acados/acados · GitHub

For that reason control horizon and prediction horizon are always the same. Isn’t it?

As I stated above, different control and prediction horizon can be formulated equivalently by using a longer last shooting interval in my opinion.


1 Like