## controling equations with subsets

Problems with syntax of GAMS
fensterflieger
User
Posts: 2
Joined: 1 month ago

### controling equations with subsets

Dear all,

I have the following two sets

Code: Select all

``````technology
subset_of_tech(technology)``````
and the following two parameters/variables:

Code: Select all

``````var(technology)
par(technology)``````
If I now want a constraint equation to hold over subset_of_technology, which of the following two ways is possible?:

Code: Select all

``constraint(subset_of_tech).. var(technology) =g= par(technology)``
or

Code: Select all

``constraint(subset_of_tech).. var(subset_of_tech) =g= par(subset_of_tech)``

Unfortunately I couldn't find any information on this or just used the wrong search string .... If anyone could help me out, I'd be really grateful!

Best,
F.

Manassaldi
User
Posts: 65
Joined: 1 year ago
Location: Rosario - Argentina

### Re: controling equations with subsets

Bye

constraint(technology)\$subset_of_tech(technology).. var(technology) =g= par(technology);

fensterflieger
User
Posts: 2
Joined: 1 month ago

### Re: controling equations with subsets

This is great help, thank you a lot!

My set "technology" actually consists of two indices:

Code: Select all

``technology(i,j)``
Assuming that there is another set, say h, can I then use the following notation:

Code: Select all

``constraint(technology,h)\$subset_of_tech(technology).. var(technology,h) =g= par(technology,h);``
In other words, does this result in

Code: Select all

``constraint(i,j,h)``
?

Best,
F.

Manassaldi
User
Posts: 65
Joined: 1 year ago
Location: Rosario - Argentina

### Re: controling equations with subsets

Hi, you must always reference to the original set (i, j)

for example:

set
i /i1*i10/
j /j1*j15/
h /h1*h40/
technology(i,j)
subset_of_tech(i,j)
;
technology(i,j)= some set definition
subset_of_tech(i,j)= some set definition

constraint(i,j,h)\$(technology(i,j) and subset_of_tech(technology)).. var(i,j,h) =g= par(i,j,h);

equation "constraint" applies to all pairs of values of (i, j) that belong to the subset "technology" and "subset_of_tech" and for all set h.
This happens because the "and" between the two subsets was used

Bye!