How to conditionalize a constraint in mip?

2 visualizzazioni (ultimi 30 giorni)
I have an integer variable X that counts down. When it takes the value of zero a binary variable A should take the value 1. Is there a way to do this in Matlab?

Risposta accettata

Matt J
Matt J il 24 Nov 2015
Impose the linear constraints
A+X>=1
A<=1-X/Xmax
where Xmax is the maximum value that X can assume.
  6 Commenti
Matt J
Matt J il 10 Giu 2016
I don't see any X's in there...
Nana
Nana il 11 Giu 2016
I thought a is similar with X, but then I realized X is count-down integer, not continuous variable. Anyway, do you still any idea to solve it? Thanks.

Accedi per commentare.

Più risposte (1)

Matt J
Matt J il 24 Nov 2015
Modificato: Matt J il 25 Nov 2015
Decompose into 2 sub-problems.
  1. A version of the original problem where A is fixed at 0, and a lower bound of 1 is applied to X
  2. A version of the original problem where X is fixed at 0 and A is fixed at 1.
Then see which sub-problem produces the more optimal value.

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by