I want to develop a model extension of capacitated location problem.

The variables are a binary $x_i$ and a continuous $Q_i$. The following condition must be satisfied:

  1. if $x_i = 0$, $Q_i$ must be zero.
  2. if $x_i = 1$, $Q_i \geq 0$.

How do we formulate it in the integer programming formulation?

Thank you for your answer.


2 Answers 2


Let $M_i$ be an upper bound on $Q_i$, and impose linear big-M constraints $0 \le Q_i \le M_i x_i$.


I tend to prefer logical constraints to big M unless big M are really needed.

In OPL CPLEX we can write

int n=10;
range r=1..n;

dvar boolean x[r];
dvar float+ Q[r];

subject to
  forall(i in r) (x[i]==0) => (Q[i]==0);
  • $\begingroup$ Maybe you know how these constarints are handled in OPL. Are they converted to linear big M constraints or are they imposed through branching? I have often seen very weak LP relaxations and slow progress when improving the bound when I use these logical constraints. $\endgroup$
    – Sune
    Aug 21, 2020 at 18:02
  • $\begingroup$ ibm.com/support/pages/… $\endgroup$ Aug 21, 2020 at 18:13
  • $\begingroup$ Thank you very much. That confirmed my own experience and add some additional info. $\endgroup$
    – Sune
    Aug 21, 2020 at 18:43
  • $\begingroup$ Thank you. I use CPLEX for my academic research and teaching. The code is very valuable for me. $\endgroup$ Sep 8, 2020 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.