Search code examples
linear-programmingamplglpk

how I can make two index inequal in ampl?


I know if I want to make 2 index inequal in ampl I have to use the following term:

s.t. b2{s in S, p in P1, j in D1, i in P1, k in D1, r in R:p!=i}

But if I have to make also j!=k what I have to do? I tried the following options but non of them worked!

s.t. b2{s in S, p in P1, j in D1, i in P1, k in D1, r in R:p!=i , j!=k}

s.t. b2{s in S, p in P1, j in D1, i in P1, k in D1, r in R:p!=i : j!=k}

s.t. b2{s in S, p in P1, j in D1, i in P1, k in D1, r in R:p!=i  j!=k}

Solution

  • You can use and:

    b2{s in S, p in P1, j in D1, i in P1, k in D1, r in R : p!=i and j!=k}