equaiton based on part of a set

Hi

sameas(a,b) expects both a and b in the equation, so they can be compared (e.g. eq1(a,b)$(not sameas(a,b)).

Example:

set A/a1*a10/;
set B(A)/a2*a4/;
set C(A);
C(A)= not B(A);

parameter t(a,b);

t(a,b)$(not sameas(a,b)) = 1;

display t;

Renger

When you do:

Eq1(A)$(not sameas (A,B))

You have no control over set B. This is not a valid gams statement, and will trigger and “Uncontrolled set entered as constant” error.

Conditions are meant to be evaluated in particular elements of the sets. sameas(A,B) is not for checking if an element of A belongs in B, rather, that an element of A being considered is the same as the element of B being considered, in a particular “instance” of the equation.

Example of sameas():

Set A /a1*a3/;
set b /a1*a3/;

parameter k(a,b);

k(a,b)$(not sameas(a,b))=1;

display k;

:laughing: at similarity of example