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

조회 수: 1 (최근 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: []

Community Treasure Hunt

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

Start Hunting!

Translated by