フィルターのクリア

Optimization Constraint: One of every two variable pairs must be zero!

1 回表示 (過去 30 日間)
Mathias Dirksmeier
Mathias Dirksmeier 2018 年 9 月 20 日
Dear Community,
thanks for being so quick with my earlier post. Now, I just ran into another problem:
I apply the fmincon solver to solve an optimization function as follows, with x being of the dimension of [2*8760 x 1]:
fun = @(x) x(:).'*p(:);
Now, I want to constrain that for every two elements of x, one must equal zero. Means, either x1 or x2 is zero; the same for the elements x3 and x4, x5 and x6 and so on...
Doing so, I can only use the constraint syntax as follows:
  • a) Aineq*x <= bineq
  • b) Aeq*x = beq
So, I would have to define either Aineq or Aeq and bineq or beq to achieve this constraint. One way I thought of:
If I had a function that returns 1 for non-zero elements and zero for zero elements, I could define beq as only zeros and Aeq as:
(func func 0 0 0 0 ...
0 0 func func 0 0 ...
0 0 0 0 func func ...
...)
Which would also lead me to the question: Can I insert functions into constraint matrices? And if yes, how and what would be such a function?
I am really looking forward to your thoughts on this! Thanks a lot!

回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by