I am trying to model some logical constraints in ILOG. Logical constraints could be given such as:

  • Constraint 1 or Constraint 2,

  • Constraint 3 or Constraint 4,

  • Constraint 5 or Constraint 6.

The six constraints in question are listed below. \begin{align}&\,\,\sum_{s=1}^Sx_{is}=1\quad\forall i\in T\\\text{Constraint}\,1:&\,\,\sum_{s=1}^Ss\cdot x_{is}-\sum_{s=1}^Ss\cdot x_{js}&=0&\quad(i,j)\in\text{linked}\\\text{Constraint}\,2:&\,\,\sum_{s=1}^Ss\cdot x_{is}-\sum_{s=1}^Ss\cdot x_{j(2\cdot m-s)}&=0&\quad(i,j)\in\text{linked}\\\text{Constraint}\,3:&\,\,\left\vert\sum_{s=1}^Ss\cdot x_{is}-\sum_{s=1}^Ss\cdot x_{js}\right\vert&\ge d_1&\quad(i,j)\in\min\\\text{Constraint}\,4:&\,\,\left\vert\sum_{s=1}^Ss\cdot x_{is}-\sum_{s=1}^Ss\cdot x_{j(2\cdot m-s)}\right\vert&\ge d_1&\quad(i,j)\in\min\\\text{Constraint}\,5:&\,\,\left\vert\sum_{s=1}^Ss\cdot x_{is}-\sum_{s=1}^Ss\cdot x_{js}\right\vert&\le d_2&\quad(i,j)\in\max\\\text{Constraint}\,6:&\,\,\left\vert\sum_{s=1}^Ss\cdot x_{is}-\sum_{s=1}^Ss\cdot x_{j(2\cdot m-s)}\right\vert&\le d_2&\quad(i,j)\in\max\end{align} Only one of the constraints in each group should be satisfied and active, i.e if Constraint 1 is active, Constraint 2 should not be active, or vice versa.

I have tried some logical constraints definition method, e.g. Big M method, but I could not define the constraints and run the model. Since there are too many sum functions in my model, it is very challenging to build a big-M model. So I need your help.

I would appreciate it if you have any suggestions. Thank you in advance. Regards.


1 Answer 1


You can enforce constraints 1 and 2 by instead imposing $x_{i,s}= x_{j,s}+ x_{j, 2m-s}$. For the other four, you can impose no-good constraints of the form $$x_{i,s}+ \sum\limits_{(j,t)\in D_{i,s}} x_{j,t}\le 1,$$ where $D_{i,s}$ is the set of disallowed assignments for $j$ if $i$ is assigned to $s$.

  • $\begingroup$ Thank you Rob. Your suggestion for constraint 1 and 2 can be runnable constraints.But I do not understand that your suggestion for the other four is additional constraints or instead of related my constraints? Regards. $\endgroup$
    – memop
    Commented Oct 18, 2019 at 15:39
  • $\begingroup$ The no-good constraints would replace constraints 3 through 6. $\endgroup$
    – RobPratt
    Commented Oct 18, 2019 at 15:43
  • $\begingroup$ RHS is $d_1$ for constraints 3-4 and $d_2$ for constraints 5-6. RHS $\le1$ means the only variable is equal to $1$. E.g. if $d_1$ is $3$ these constraints won't be suitable. The aim of these constraints is that the gap of assignment places between two related variables should be $\min d_1$ and $\max d_2$. E.g. if the gap minimum between variable $x_1$ and $x_7$ is $2$ the assignment $x_{15}=1$ and $x_{71}=1$ is proper but if $x_{15}=1$ and $x_{74}$ this is not proper as the assignment place of $x_1$ is $5$ and $x_7$ is $4$ and the gap is $5-4=1<2$. A similar situation is valid for maximum gap. $\endgroup$
    – memop
    Commented Oct 18, 2019 at 16:31
  • $\begingroup$ I made a correction just now. $\endgroup$
    – RobPratt
    Commented Oct 18, 2019 at 16:51
  • $\begingroup$ Thanks Rob. I will try your suggestion. It is important to define $D_{is}$ by using ILOG expression. Regards. $\endgroup$
    – memop
    Commented Oct 18, 2019 at 17:10

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.