Same question - as above

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Same question - as above

Post by Archiver »



I just posted a question: Let me give a simpler example for easy
comprehension:

The area planted in quarters 1, 2 and 3 are 1, 8 and 12 acres
respectively
The area planted in quarters 10, 11 and 12 are 9, 11 and 100 acres
respectively.

I have to sum them and match them up:
so that, I can have Total(q) is a set such as [1, 8, 12, 0, 0, 0, 0,
0, 0, 9, 11, 100]

Although T0 and T1 are subsets of the set Q, they do not get matched
properly and I get the error message 149 - UNCONTROLLED SET ENTERED AS
CONSTANT.

How can the indices in subsets T0 and T1 be matched with the bigger
set Q?
========================================================


set
Q /q1*q12/
T0(q) /q1*q3/
T1(q) /q10*q12/
;

Parameter

Area(t0) /q1 1, q2 8, q3 12/

Area1(t1) /q10 9, q11 11, q12 100/

Total(q);

Total(q) = Area(t0) + Area(t1);

Display Area, Area1, Total;
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: Same question - as above

Post by Archiver »



Hi,

The way you organize your data is unconventional. Unsually, you would
have

parameter total(q) / q1 1, q2 8, q3 12, q10 9, q11
11, q12 100/;
parameter area(t0), area1(t1);

area(t0) = total(t0); area1(t1) = total(t1);

but you can also do it in your data layout:

Total(t0) = Area(t0);
Total(t1) = Area1(t1);

or

Total(q) = sum(t0(q), Area(t0)) + sum(t1(q), Area1(t1));

These two ways are identical if t0 and t1 are disjoint. If they
overlap, total will have the value of area1 in the first case, while
we have the sum of area and area1 in the latter case.

Hope this helps,
Michael Bussieck - GAMSWorld Coordinator

On Jun 9, 4:47 pm, kmsubbu wrote:
> > I just posted a question: Let me give a simpler example for easy
> > comprehension:
> >
> > The area planted in quarters 1, 2 and 3 are 1, 8 and 12 acres
> > respectively
> > The area planted in quarters 10, 11 and 12 are 9, 11 and 100 acres
> > respectively.
> >
> > I have to sum them and match them up:
> > so that, I can have Total(q) is a set such as [1, 8, 12, 0, 0, 0, 0,
> > 0, 0, 9, 11, 100]
> >
> > Although T0 and T1 are subsets of the set Q, they do not get matched
> > properly and I get the error message 149 - UNCONTROLLED SET ENTERED AS
> > CONSTANT.
> >
> > How can the indices in subsets T0 and T1 be matched with the bigger
> > set Q?
> > ========================================================
> >
> > set
> > Q /q1*q12/
> > T0(q) /q1*q3/
> > T1(q) /q10*q12/
> > ;
> >
> > Parameter
> >
> > Area(t0) /q1 1, q2 8, q3 12/
> >
> > Area1(t1) /q10 9, q11 11, q12 100/
> >
> > Total(q);
> >
> > Total(q) = Area(t0) + Area(t1);
> >
> > Display Area, Area1, Total;
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---


Post Reply