Optimization problem, how to limit the individual values in the control vector to a certain range

4 次查看(过去 30 天)
Hello,
I am doing an trajectory optimization problem with fmincon. I have a running and minimizing problem. However, I am tweaking the solution a bit. The most optimal solution rides the constraint at some points. As a consequence, my control variable rapidly changes between its upper and lower limit to stay on this most optimal constrained path (similar to bang-bang control behaviour).
I now want to smoothen out this behaviour of my control variable (as it is not realistic) by saying that the next value in my control vector can only differ from the previous value by lets say 20%. (so 0.8 < u(i+1)/u(i) < 1.2, 0.8 < u(i+2)/u(i+1) < 1.2, 0.8 < u(i+3)/u(i+2) < 1.2 etc.)
However I am struggling to implement this because the length of my control vector is variable.
Any advice or ideas would be highly appreciated.
Toon

回答(1 个)

Matt J
Matt J 2021-4-4
编辑:Matt J 2021-4-4
Assuming the u(i) are non-negative, the condition can be written as a linear constraint.
u=optimvar('u',[10,1], 'LowerBound',0);
con.lower=u(2:end)>=u(1:end-1)*0.8;
con.upper=u(2:end)<=u(1:end-1)*1.2;
prob=prob2matrices({u},'Constraints',con) %https://www.mathworks.com/matlabcentral/fileexchange/74481-prob2matrices-a-selective-version-of-prob2struct
prob =
struct with fields:
intcon: []
lb: [10×1 double]
ub: [10×1 double]
Aineq: [18×10 double]
bineq: [18×1 double]
Aeq: []
beq: []

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by