Subsets in GAMS

Can I define subsets as in the following: t0(q), t1(q) and t2(q)
The equation is defined over all quarters q – but they variables are
computed over the subsets - I get the error message:

149 Uncontrolled set entered as constant

Do you see any glaring mistake on using the syntax for equations?
Please let me know.

Subbu

SET
F Two feedstocks considered /Grass, Stover/
q time /q1q84/
z Zone/region /z1
z6/

t0(q) subset of q /q1q44/
t1(q) subset of q /q5
q48/
t2(q) subset of q /
q9*q52/ ;



EQUATIONS:
eGrassSupply(q)…
vGrassS(q) =e= Sum[z,Yield0(“Grass”,t0) *
vGrassAc0(z,t0)]

Sets t0, t1 and t2 in your equation are not properly controlled and that is giving the error. I am not sure what is the best way to work around this. However, one option would be to define Yield0, Yield1 and Yield2 over the main set q, and while doing calculations. ensure that the values for Yield0, Yield1 and Yield2 are zero outside the range of sets t0, t1 and t2, respectively (you can do this using some initialization). This will ensure that your final value is correct. Difficult to say if this will work without knowing the complete code.

  • Yogendra.





    On Tue, Jun 9, 2009 at 3:32 PM, kmsubbu wrote:


    Can I define subsets as in the following: t0(q), t1(q) and t2(q)
    The equation is defined over all quarters q – but they variables are
    computed over the subsets - I get the error message:

149 Uncontrolled set entered as constant

Do you see any glaring mistake on using the syntax for equations?
Please let me know.

Subbu

SET
F Two feedstocks considered /Grass, Stover/
q time /q1q84/
z Zone/region /z1
z6/

t0(q) subset of q /q1q44/
t1(q) subset of q /q5
q48/
t2(q) subset of q /
q9*q52/ ;



EQUATIONS:
eGrassSupply(q)…
vGrassS(q) =e= Sum[z,Yield0(“Grass”,t0) *
vGrassAc0(z,t0)]

Hi Ali,

I would suggest you use only one set for the cities and create a subset to use in the parameter

**Define set of cities as:
set i /120/
**Define subsets on set i as:
set j(i)/1
20)
set k(i) /1*4/
**Now you can define whatever parameter you want over the subsets like
Parameter x(k,j)
Parameter y(k)

On Fri, Oct 7, 2011 at 11:19 AM, /\ l_ ! wrote:

Hello Everybody
Thank You For Reading My Question
I Have A Set Of Cities In My Model And The Cities Are Denoted By “i”
and “j”
My Model Outcome Is A Parameter x(i,j) Which Is A Binary Variable And
For Some "i’ and "j"s It Is 1.
How Can I Define A Subset Of The Original Set That Contains The “i”
and "j"s That Their x(i,j) Is Equal To 1.
To Make It More Clear Suppose I Have A Set Of Cities From 1 to 20.
The Model Answers x(i,j) Are x(1,2)=1 x(3,4)=1 And The Rest Are Equal
To 0.
How Can I Define A Subset Of The Original Set Which Becomes {1,2,3,4}
When The Answers Are Like Above?


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

set
z(i,j)
;
z(i,j)$(x.l(i,j)=1) = yes;


On 7 Okt., 05:19, “/\ l_ !” wrote:

Hello Everybody
Thank You For Reading My Question
I Have A Set Of Cities In My Model And The Cities Are Denoted By “i”
and “j”
My Model Outcome Is A Parameter x(i,j) Which Is A Binary Variable And
For Some "i’ and "j"s It Is 1.
How Can I Define A Subset Of The Original Set That Contains The “i”
and "j"s That Their x(i,j) Is Equal To 1.
To Make It More Clear Suppose I Have A Set Of Cities From 1 to 20.
The Model Answers x(i,j) Are x(1,2)=1 x(3,4)=1 And The Rest Are Equal
To 0.
How Can I Define A Subset Of The Original Set Which Becomes {1,2,3,4}
When The Answers Are Like Above?

\

if you want a one dimensional set, you could try this:

set
z(i)
;
loop((i,j)$(x.l(i,j)=1),
z(i) = yes;
z(j) = yes;
);

On 7 Okt., 05:19, “/\ l_ !” wrote:

Hello Everybody
Thank You For Reading My Question
I Have A Set Of Cities In My Model And The Cities Are Denoted By “i”
and “j”
My Model Outcome Is A Parameter x(i,j) Which Is A Binary Variable And
For Some "i’ and "j"s It Is 1.
How Can I Define A Subset Of The Original Set That Contains The “i”
and "j"s That Their x(i,j) Is Equal To 1.
To Make It More Clear Suppose I Have A Set Of Cities From 1 to 20.
The Model Answers x(i,j) Are x(1,2)=1 x(3,4)=1 And The Rest Are Equal
To 0.
How Can I Define A Subset Of The Original Set Which Becomes {1,2,3,4}
When The Answers Are Like Above?

\

Thanks To Everybody

On Oct 7, 3:51 pm, Matthes wrote:

set
z(i,j)
;
z(i,j)$(x.l(i,j)=1) = yes;

On 7 Okt., 05:19, “/\ l_ !” wrote:

Hello Everybody
Thank You For Reading My Question
I Have A Set Of Cities In My Model And The Cities Are Denoted By “i”
and “j”
My Model Outcome Is A Parameter x(i,j) Which Is A Binary Variable And
For Some "i’ and "j"s It Is 1.
How Can I Define A Subset Of The Original Set That Contains The “i”
and "j"s That Their x(i,j) Is Equal To 1.
To Make It More Clear Suppose I Have A Set Of Cities From 1 to 20.
The Model Answers x(i,j) Are x(1,2)=1 x(3,4)=1 And The Rest Are Equal
To 0.
How Can I Define A Subset Of The Original Set Which Becomes {1,2,3,4}
When The Answers Are Like Above?

\