How to incorporate specific condition in GAMS equation

Dear All,



I am a beginner GMAS user. I have to write a material balance equation:



Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl = Simga k Sigma m Fklm + Simga j Fjkl (For all l & k)



I wrote it in code as:



massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;



I got error 149: set is under control already



I don’t know how to incorporate the condition (for all l & k) into code.



Can any body guide me please?





THANKS & REGARDS,


BAZMI

\

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.

Reply-to: gamsworld@googlegroups.com

Hi,

You need to include the equation indexes l and k

Enviado via iPhone

Em 12/04/2011, Ã s 18:43, AQEEL AHMED BAZMI escreveu:

Dear All,

I am a beginner GMAS user. I have to write a material balance equation:

Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl = Simga k Sigma m Fklm + Simga j Fjkl (For all l & k)

I wrote it in code as:

massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

I got error 149: set is under control already

I don’t know how to incorporate the condition (for all l & k) into code.

Can any body guide me please?

THANKS & REGARDS,


BAZMI


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.

THANKS LUIZ

On Wed, Apr 13, 2011 at 9:59 AM, Luiz Carlos wrote:

Hi,

You need to include the equation indexes l and k

Enviado via iPhone

Em 12/04/2011, Ã s 18:43, AQEEL AHMED BAZMI escreveu:

Dear All,



I am a beginner GMAS user. I have to write a material balance equation:



Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl =  Simga k Sigma m Fklm + Simga j Fjkl    (For all l & k)



I wrote it in code as:



massbal..  sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;



I got error 149: set is under control already



I don't know how to incorporate the condition (for all l & k) into code.



Can any body guide me please?





THANKS & REGARDS,
________________________________________________________________________________
BAZMI


--
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.



\

Engr.AQEEL.A.BAZMI


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.

Dear Ahmed!
All was mixed.

You wrote

massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

It have to be

massbal(l)… sum((s,j), y(s,j,l)) =e= something here with the same dimensions(l)
or

massbal(s,j,l)… sum ((r,c), f(s,r,j,c,l) =e= something here with the same dimensions(s,j,l)

or

massbal(s,j,l)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= =e= something here with the same dimensions(s,j,l)
have to be

massbal(s,j,l,k)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

Best! Andre from Lahore


13.04.2011, 01:43, “AQEEL AHMED BAZMI” :

Dear All,



I am a beginner GMAS user. I have to write a material balance equation:



Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl = Simga k Sigma m Fklm + Simga j Fjkl (For all l & k)



I wrote it in code as:



massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;



I got error 149: set is under control already



I don’t know how to incorporate the condition (for all l & k) into code.



Can any body guide me please?





THANKS & REGARDS,


BAZMI

\

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.


\

With kindly regards!
Andre Savitsky
E-mail:andresavit@yandex.ru
andre_savit@yahoo.com


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.

My dear Andre!

I thank you for your guidance and so detailed reply.
I tried this but i get following response:


massbal(j,k,l,m)… sum((j, s), y(j, k)) * sum((r, c), f(s, r, c, j, l)) =
**** $125 $149
e= sum((k ,m),fms(k, l, m)) + sum(j, flc(j, k, l)) ;
$125,125 $125
:slight_smile:


On Wed, Apr 13, 2011 at 11:22 PM, Savitsky Andre wrote:

Dear Ahmed!
All was mixed.

You wrote

massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

It have to be

massbal(l)… sum((s,j), y(s,j,l)) =e= something here with the same dimensions(l)
or

massbal(s,j,l)… sum ((r,c), f(s,r,j,c,l) =e= something here with the same dimensions(s,j,l)

or

massbal(s,j,l)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= =e= something here with the same dimensions(s,j,l)
have to be

massbal(s,j,l,k)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

Best! Andre from Lahore


13.04.2011, 01:43, “AQEEL AHMED BAZMI” :

Dear All,



I am a beginner GMAS user. I have to write a material balance equation:



Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl = Simga k Sigma m Fklm + Simga j Fjkl (For all l & k)



I wrote it in code as:



massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;



I got error 149: set is under control already



I don’t know how to incorporate the condition (for all l & k) into code.



Can any body guide me please?





THANKS & REGARDS,


BAZMI

\

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.


\

With kindly regards!
Andre Savitsky
E-mail:andresavit@yandex.ru
andre_savit@yahoo.com


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.



\

Engr.AQEEL.A.BAZMI


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.

Hi Aqueel, I think tath you have problems in the sets:
If you put this sentence:

massbal(j,k,l,m)… sum((j, s), y(j, k)) * sum((r, c), f(s, r, c, j, l)) =e= sum((k ,m),fms(k, l, m)) + sum(j, flc(j, k, l)) ;

You are trying to summarize the same equation for every j,k,l and m. If this is correct (you can verify this by deriving the equations by hand with a small number of elements in each set and see if the equation reflects whatever you want). Anyway, I can note that you have some mistakes:

sum((j, s), y(j, k)) → here y(j,k) doesn’t depend on the set s. This part must be: sum((j, k), y(j, k)) if you want a double summation in indexes j and k, or : sum((j), y(j, k)) or sum((k), y(j, k)) , if you are trying to sum for every column (file) of y, all its files(columns).

sum((r, c), f(s, r, c, j, l)) → here the sets are ok (because f depends on r and c), but you have the problem in the equations set, because “s” isn’t under control (massbal doesn’t depend on s).

Once that you fix this part, If you still have problems, then the mistake can be in the sets inside the SUM statement. Try defining Alias for the sets:

  • j, k , l, m,

and then replace the original sets inside the SUM by the alias.

I hope this works.

Best regards!!!

2011/4/13 AQEEL AHMED BAZMI

My dear Andre!

I thank you for your guidance and so detailed reply.
I tried this but i get following response:


massbal(j,k,l,m)… sum((j, s), y(j, k)) * sum((r, c), f(s, r, c, j, l)) =
**** $125 $149
e= sum((k ,m),fms(k, l, m)) + sum(j, flc(j, k, l)) ;
$125,125 $125
:slight_smile:


On Wed, Apr 13, 2011 at 11:22 PM, Savitsky Andre wrote:

Dear Ahmed!
All was mixed.

You wrote

massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

It have to be

massbal(l)… sum((s,j), y(s,j,l)) =e= something here with the same dimensions(l)
or

massbal(s,j,l)… sum ((r,c), f(s,r,j,c,l) =e= something here with the same dimensions(s,j,l)

or

massbal(s,j,l)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= =e= something here with the same dimensions(s,j,l)
have to be

massbal(s,j,l,k)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

Best! Andre from Lahore


13.04.2011, 01:43, “AQEEL AHMED BAZMI” :

Dear All,



I am a beginner GMAS user. I have to write a material balance equation:



Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl = Simga k Sigma m Fklm + Simga j Fjkl (For all l & k)



I wrote it in code as:



massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;



I got error 149: set is under control already



I don’t know how to incorporate the condition (for all l & k) into code.



Can any body guide me please?





THANKS & REGARDS,


BAZMI

\

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.


\

With kindly regards!
Andre Savitsky
E-mail:andresavit@yandex.ru
andre_savit@yahoo.com


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.



\

Engr.AQEEL.A.BAZMI


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.



\

Daniel Andrés Navia López
Ingeniero Civil Químico
Mg.Sc.Ciencias de la Ingeniería, Mención Ingeniería Química
Máster en Investigación en Ingeniería de Procesos y Sistemas
626752875


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.

Thanks Deniel!

I try and come back.

On Thu, Apr 14, 2011 at 4:27 PM, daniel navia wrote:

Hi Aqueel, I think tath you have problems in the sets:
If you put this sentence:

massbal(j,k,l,m)… sum((j, s), y(j, k)) * sum((r, c), f(s, r, c, j, l)) =e= sum((k ,m),fms(k, l, m)) + sum(j, flc(j, k, l)) ;

You are trying to summarize the same equation for every j,k,l and m. If this is correct (you can verify this by deriving the equations by hand with a small number of elements in each set and see if the equation reflects whatever you want). Anyway, I can note that you have some mistakes:

sum((j, s), y(j, k)) → here y(j,k) doesn’t depend on the set s. This part must be: sum((j, k), y(j, k)) if you want a double summation in indexes j and k, or : sum((j), y(j, k)) or sum((k), y(j, k)) , if you are trying to sum for every column (file) of y, all its files(columns).

sum((r, c), f(s, r, c, j, l)) → here the sets are ok (because f depends on r and c), but you have the problem in the equations set, because “s” isn’t under control (massbal doesn’t depend on s).

Once that you fix this part, If you still have problems, then the mistake can be in the sets inside the SUM statement. Try defining Alias for the sets:

  • j, k , l, m,

and then replace the original sets inside the SUM by the alias.

I hope this works.

Best regards!!!

2011/4/13 AQEEL AHMED BAZMI

My dear Andre!

I thank you for your guidance and so detailed reply.
I tried this but i get following response:


massbal(j,k,l,m)… sum((j, s), y(j, k)) * sum((r, c), f(s, r, c, j, l)) =
**** $125 $149
e= sum((k ,m),fms(k, l, m)) + sum(j, flc(j, k, l)) ;
$125,125 $125
:slight_smile:


On Wed, Apr 13, 2011 at 11:22 PM, Savitsky Andre wrote:

Dear Ahmed!
All was mixed.

You wrote

massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

It have to be

massbal(l)… sum((s,j), y(s,j,l)) =e= something here with the same dimensions(l)
or

massbal(s,j,l)… sum ((r,c), f(s,r,j,c,l) =e= something here with the same dimensions(s,j,l)

or

massbal(s,j,l)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= =e= something here with the same dimensions(s,j,l)
have to be

massbal(s,j,l,k)… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;

Best! Andre from Lahore


13.04.2011, 01:43, “AQEEL AHMED BAZMI” :

Dear All,



I am a beginner GMAS user. I have to write a material balance equation:



Simga s Sigma j Ysjk X Sigma r Simga c Fsrjcl = Simga k Sigma m Fklm + Simga j Fjkl (For all l & k)



I wrote it in code as:



massbal… sum((s,j), y(s,j,l)) * sum ((r,c), f(s,r,j,c,l) =e= sum((k,m), f(k,l,m)) + sum (j, f(j,k,l)) ;



I got error 149: set is under control already



I don’t know how to incorporate the condition (for all l & k) into code.



Can any body guide me please?





THANKS & REGARDS,


BAZMI

\

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.


\

With kindly regards!
Andre Savitsky
E-mail:andresavit@yandex.ru
andre_savit@yahoo.com


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.



\

Engr.AQEEL.A.BAZMI


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.



\

Daniel Andrés Navia López
Ingeniero Civil Químico
Mg.Sc.Ciencias de la Ingeniería, Mención Ingeniería Química
Máster en Investigación en Ingeniería de Procesos y Sistemas
626752875


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.



\

Engr.AQEEL.A.BAZMI


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.