0

I want to implement " if($x_{i,k}=1$ AND $x_{j,k}=1$) then $p[j]\geq p[i]$ " as a linear constraint. Where $x_{i,k}$, $x_{j,k}$ are binary decision variables and p[i], p[j] are integer decision variables. I know that we can implement if-then constraints as link. Can someone please help me with this logical AND operation?

Thank you.

  • 1
    If that answer was satisfactory for you, then $p[j]-p[i]\ge M(x_{i,k}+x_{jk}-2)$ is no worse. – fedja Jun 18 '19 at 15:54
  • Thank you for the response. But suppose $x_{i,k}=1$ and $x_{j,k}=0$ then the constraint suggested by you will make $p[j]\geq p[i]-M$ which is conflicting with my original constraint. Can you please suggest some improvement? If both $x_{i,k}$ and $x_{j,k}$ are 1 then and then only I want to make $p[j]>=p[i]$. – Ajinkya Bankar Jun 18 '19 at 18:05
  • How large can $p[i]$ be? – fedja Jun 18 '19 at 20:28
  • I think @fedja's suggestion is correct. You said you want the constraint $p[j] \ge p[i]$ if $x_{ik}=x_{jk}=1$. If $x_{ik}=1$ and $x_{jk}=0$ then the constraint is $p[j] \ge p[i] - M$, as you said, but you don't need the constraint in that case -- it is "turned off". Isn't that what you wanted? – LarrySnyder610 Jun 18 '19 at 21:00
  • @LarrySnyder610, You are correct sir. If $x_{i,k}=1$ and $x_{j,k}=0$ then this constraint should be turned off. Similarly for $x_{i,k}=0$ , $x_{j,k}=1$ and $x_{i,k}=0$ , $x_{j,k}=0$ constraint should be off. – Ajinkya Bankar Jun 18 '19 at 22:46
  • So fedja ‘s answer is correct, yes? – LarrySnyder610 Jun 18 '19 at 22:46
  • @fedja upper limit of p[i] can be 100. – Ajinkya Bankar Jun 18 '19 at 22:47
  • And what is the lower limit? – fedja Jun 18 '19 at 22:49
  • @LarrySnyder610 if fedja's constraint is used then for conditions other than $x_{i,k}=1$, $x_{j,k}=1$ it becomes $p[j]\geq p[i]-M$ which I dont want. – Ajinkya Bankar Jun 18 '19 at 22:50
  • @fedja, lower limit can be zero – Ajinkya Bankar Jun 18 '19 at 22:51
  • Then take $M=100$ in the formula and have nothing to worry about :-) – fedja Jun 18 '19 at 22:52
  • @fedja Its working perfectly. Thank you so much Sir :-) – Ajinkya Bankar Jun 18 '19 at 23:06
  • I’m still a little unclear about whether @fedja ‘s approach is working for you. But if so, fedja should post as an answer so you can accept it. And if not, you should clarify what’s not working. – LarrySnyder610 Jun 18 '19 at 23:21
  • @fedja 's approach is working for me. I am also unclear how is it handling for the cases other than $x_{i,k}=1$ , $x_{j,k}=1$? – Ajinkya Bankar Jun 19 '19 at 14:38
  • @fedja Is there any way to use this constraint without big-M formulation? Even if it is nonlinear then also it's fine. – Ajinkya Bankar Aug 16 '19 at 18:30

0 Answers0