How can I control decision variables?
Mostrar comentarios más antiguos
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?
Respuestas (1)
Alan Weiss
el 29 de Oct. de 2017
0 votos
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
Categorías
Más información sobre Optimization Toolbox 시작하기 en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!