Logical indicator in objective function
11 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Walter Roberson
2016 年 3 月 30 日
t = diff(x) + l - g;
objective = sum( t(t>0) )
No loop needed.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Error Detection and Correction についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!