Logical indicator in objective function
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
How to write a logical indicator as part of objective function? The objective function is as below
sum (a*(x(i) - x(i-1) + l(i) - g(i)))
a is 1 when
x(i) - x(i-1) + l(i) - g(i) > 0
otherwise a is 0. The decision variable is x.
Thanks!
0 Kommentare
Antworten (1)
Walter Roberson
am 30 Mär. 2016
t = diff(x) + l - g;
objective = sum( t(t>0) )
No loop needed.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Error Detection and Correction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!