Penalize input change

Hi:

Is there a way to penalize changes in the control variables in a discrete system (linear cost) and set hard constraints? Is it by setting the parameter p? Or is it possible to penalize changes in the control variables by setting yref as shown in the code below?
(u_old refers to the control variable solved in the previous step)

for t in range(N):
    ref = [yref1, yref2, 0, 0, 0, u_old[0], u_old[1], u_old[2], u_old[3]]
    ref = np.array(ref)
    solver.set(t, "yref", ref)

Thanks

Hi,

penalizing control input changes through yref sounds reasonable to me, but setting constraints might be a bit trickier.

There is an example of doing this with the MATLAB interface:

which can be adapted for python. In the readme there are also some links to previous posts related to the topic.

Hope this helps!

Kind regards,
Josip

Hi,

Thank you for your help, I will read the code carefully and try to implement it on python

Best Regards,
Tom