I'm trying to make i is not equal to j

Problems with syntax of GAMS
Post Reply
mrmrmr
User
User
Posts: 1
Joined: 2 weeks ago

I'm trying to make i is not equal to j

Post by mrmrmr »

This is a minimization problem, but when I enter some constraints, i1 takes the values ​​j1, i2, j2 in the table value and my result is 0. How can I add a constraint so that i is not equal to j?

sets
i /1*4/
j / 1*4/
table
0 1 2 3 4
0 0 114 86 7 17
1 114 0 72 39 75
2 86 72 0 65 63
3 7 39 65 0 83
4 17 75 63 83 0
binary variables
x(i,j)
Equations

object
equ1

object..z=e=sum ((i,j),T(i,j)*X(i,j));

model TEZ /all/
solve TEZ minlp minimizing z
Manassaldi
User
User
Posts: 119
Joined: 7 years ago
Location: Rosario - Argentina

Re: I'm trying to make i is not equal to j

Post by Manassaldi »

Hi, you can try this.
object.. z =e= sum ((i,j)$(not sameas(i,j)),T(i,j)*X(i,j));

I see other errors in the code, but this must be only part of the problem
bye!
Post Reply