How to conditionalize a constraint in mip?

3 views (last 30 days)
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?

Accepted Answer

Matt J
Matt J on 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 Comments
Matt J
Matt J on 10 Jun 2016
I don't see any X's in there...
Nana
Nana on 11 Jun 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.

Sign in to comment.

More Answers (1)

Matt J
Matt J on 24 Nov 2015
Edited: Matt J on 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.

Categories

Find more on Get Started with 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!