# Formulating the conditional constraint

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?

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);
}

• 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. – Sune Aug 21 '20 at 18:02
• ibm.com/support/pages/… – Alex Fleischer Aug 21 '20 at 18:13
• Thank you very much. That confirmed my own experience and add some additional info. – Sune Aug 21 '20 at 18:43
• Thank you. I use CPLEX for my academic research and teaching. The code is very valuable for me. – Bobby Kurniawan Sep 8 '20 at 22:19