Hello
I declare
SET i / a1 a2 a3 / ;
SET j / b1 b2 b3 / ;
SET k / 1 2 3 / ;
alias i, i1 ;
alias j, j1 ;
alias k, k1 ;
Eq(i,j,k,i1,j1,k1)...
How can I make sure that the combination (i1,j1,k1) doesn't get the same as (i,j,k) ?
Eq(i,j,k,i1,j1,k1)$( (ord(i)<>ord(i1)) and (ord(j)<>ord(j1)) and (ord(k)<>ord(k1))) ... is not correct,
because it doesn't allow Eq(a1,b1,1,a1,b1,2), which should be allowed
Forbiden should be something like Eq(a1,b1,1,a1,b1,1) or Eq(a2,b1,1,a2,b1,1) ....
What is the correct way to write this?
Perhaps
Eq(i,j,k,i1,j1,k1)$( (ord(i)<>ord(i1)) and (ord(j)<>ord(j1)) and (ord(k)<>ord(k1))) ... ... ?
Somehow I messing this up!
not equal tupels
not equal tupels
Last edited by Nikou 4 years ago, edited 3 times in total.
Re: not equal tupels
Hi,
try this:
Best,
Petros
try this:
Code: Select all
eq(i,j,k,ii,jj,kk)$(ord(i) <> ord(ii) and ord(j) <> ord(jj) and ord(k) <> ord(kk))..
Petros
Re: not equal tupels
Petros
I am sorry, my question is not written down correctly. It is not about the syntax, it is about the result.
I just corrected the question.
I am sorry, my question is not written down correctly. It is not about the syntax, it is about the result.
I just corrected the question.
Re: not equal tupels
Hi nikou,
Now I see, but I think that you could get the result you want if you just replace AND with OR.
Best,
Petros
Now I see, but I think that you could get the result you want if you just replace AND with OR.
Best,
Petros
Re: not equal tupels
Nikou,
I find it helpful to use a tuple set so I can see what is in it. That's easier than looking at equations, and you can use the tuple set to define the subset of equations you generate. Like this:
I assume you will dump all the data to GDX and use GAMS Studio or GAMSIDE to look at the contents of the tuples set.
-Steve
I find it helpful to use a tuple set so I can see what is in it. That's easier than looking at equations, and you can use the tuple set to define the subset of equations you generate. Like this:
Code: Select all
sets
i / i1, i2 /
j / j1, j2 /
;
alias (i, i1), (j, j1);
set tuples(i,j,i1,j1);
tuples(i,j,i1,j1)$[not (sameas(i,i1) and sameas(j,j1))] = yes;
equation equ(i,j,i1,j1);
* equ(tuples(i,j,i1,j1)) .. blah blah;
-Steve