Is there any way to set constraints such that input is constant?

Hello,

First of all, I am grateful for the toolbox that the developers have made open source to everyone.

I have a regular set of ODEs, and I would like to solve over an NLP over a time/spatial horizon to find the optimal control input. However, my problem requires that the control input be constant throughout. I have tried setting the control input as a “parameter” but it seems like “parameters” must be set before solving for the optimisation problem.

Thanks in advance for any help!

Best,
jerluen

Hi,

I would suggest to use a time horizon of N=1, such that you only have one control input naturally.
In order to achieve good appropriate accuracy of your ODE, set the integrator settings, see Python API — acados documentation
Does that work for you?

Cheers,
Jonathan

Hi Jonathan,

Thanks for the prompt reply! :grinning:

Let’s say if I have tf = 0.5 and dt = 0.01.

If I understood you correctly, setting N=1 and changing the “time steps” property will allow me to have one control input with the integration over the shooting nodes (0, 0.01, 0.02, …, 0.5)?

Best,
jerluen

Hey,

I suggested to basically just use a single shooting interval (N=1).
If you need multiple shooting intervals (maybe that improves convergence) and need to constrain u to have only one value over the full horizon, I guess you can augment the state dynamics and use a 0 rate constraint, see here:

Does that make sense?

Cheers,
Jonathan

Hi Jonathan,

Yes this makes more sense. I was thinking that as well but came here to look for alternatives.

I will try out augmenting the state dynamics. Thanks a lot again.

Best,
jerluen