How can I control decision variables?
Mostra commenti meno recenti
I use MILP and have two decision variables u(i),v(i). u and v are non-negative variables which cannot both be non-zero simultaneously. more detailed, if u have some value, then v is zero value. The opposite is also true. How can I do that?
Risposte (1)
Alan Weiss
il 29 Ott 2017
0 voti
I assume that u and v are integers, because otherwise the problem is ill-posed.
In that case, to say that both variables cannot simultaneously be zero (for nonnegative variables) is equivalent to
u + v >= 1
This is a linear inequality that you can easily put in intlinprog syntax.
For the other part (when one variable is nonzero the other must be zero), I suppose that there is an upper bound M to your variables. In that case, these inequalities enforces that constraint:
(M+1)*u <= v % enforces u = 0 when v >= 1
(M+1)*v <= u % enforces v = 0 when u >= 1
Alan Weiss
MATLAB mathematical toolbox documentation
Categorie
Scopri di più su Optimization Toolbox 시작하기 in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!