Optimization Constraint: One of every two variable pairs must be zero!
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!