How can I control decision variables?
Show older comments
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?
Answers (1)
Alan Weiss
on 29 Oct 2017
0 votes
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
Categories
Find more on Optimization Toolbox 시작하기 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!