Beginners question

Dear all,

I am completely new here and in GAMS as well. Although I feel that it is possible and I am trying for two days now (don’t judge me too hard) to write it I didn’t go too far. If anyone is willing to help me I would be really grateful…


I am trying to write this:






in code submitted bellow:


Sets

u UNITS /unit1, unit2, unit3, unit4, unit5, unit6, unit7, unit8, unit9, unit10/

subset(u) SPECIAL UNITS /unit1, unit2/

s STREAMS /stream1, stream2, stream3, stream4, stream5, stream6, stream7/

IN(u,s)

/unit1.(stream2,stream3)

unit2.(stream2, stream3)

unit3.stream4

unit4.stream4

unit5.stream4

unit6.(stream1, stream3, stream4)

unit7.stream7

unit8.stream7

unit9.stream6

unit10.stream6/;



Variables

y(u) Binary variable for unit u
m(s) Flow of stream;


If anything is missing please correct me. Thank you in advance!


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Anyone? Someone?


Cheers,

Davor


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

David,

To write the indicated equation, add a new variable for the sum (i’ll call it newvar) as well an equation:

equation NewVarEq;

NewVarEq… newvar =e= sum((u,s)$(subset(u)$in(u,s)),y(u)*m(s));

I didn’t test but it should work; information on $ conditionals can be found in McCarl’s GAMS Guide pg 289.

McCarl’s GAMS Guide:
http://www.gams.com/dd/docs/bigdocs/gams2002/mccarlgamsuserguide.pdf

Best,
Max

On Thursday, November 14, 2013 9:25:23 AM UTC-7, Davor wrote:

Anyone? Someone?


Cheers,

Davor


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Davor

Read the forum rules and ask a question that makes sense to us. You just show code that is running fine.

Renger




\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

Info@modelworks.ch

blog.modelworks.ch





From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Davor
Sent: Donnerstag, 14. November 2013 17:25
To: gamsworld@googlegroups.com
Subject: Re: Beginners question



Anyone? Someone?





Cheers,



Davor


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you Ranger and sorry if I didn’t make myself clear.

I am trying to write Equation which I showed on picture in this code (I hope that you can see picture attached). Equation can be equal to zero it doesn’t matter now. I can’t make syntax to work.

Cheers,

Davor

On Thursday, November 14, 2013 9:17:06 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Davor

Read the forum rules and ask a question that makes sense to us. You just show code that is running fine.

Renger




\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

In…@modelworks.ch

blog.modelworks.ch





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Davor
Sent: Donnerstag, 14. November 2013 17:25
To: gams...@googlegroups.com
Subject: Re: Beginners question



Anyone? Someone?





Cheers,



Davor


Equation.jpg

Sorry, I didn’t got the picture.



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Davor
Sent: Donnerstag, 14. November 2013 21:44
To: gamsworld@googlegroups.com
Subject: Re: Beginners question



Thank you Ranger and sorry if I didn’t make myself clear.



I am trying to write Equation which I showed on picture in this code (I hope that you can see picture attached). Equation can be equal to zero it doesn’t matter now. I can’t make syntax to work.



Cheers,



Davor

On Thursday, November 14, 2013 9:17:06 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Davor

Read the forum rules and ask a question that makes sense to us. You just show code that is running fine.

Renger




\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

In…@modelworks.ch

blog.modelworks.ch





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Davor
Sent: Donnerstag, 14. November 2013 17:25
To: gams...@googlegroups.com
Subject: Re: Beginners question



Anyone? Someone?





Cheers,



Davor


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you very much Maxwell! This is what I was looking for. Thank you for detailed explanation.

Sincerely,

Davor

On Thursday, November 14, 2013 9:09:34 PM UTC+1, Maxwell Brown wrote:

David,

To write the indicated equation, add a new variable for the sum (i’ll call it newvar) as well an equation:

equation NewVarEq;

NewVarEq… newvar =e= sum((u,s)$(subset(u)$in(u,s)),y(u)*m(s));

I didn’t test but it should work; information on $ conditionals can be found in McCarl’s GAMS Guide pg 289.

McCarl’s GAMS Guide:
http://www.gams.com/dd/docs/bigdocs/gams2002/mccarlgamsuserguide.pdf

Best,
Max

On Thursday, November 14, 2013 9:25:23 AM UTC-7, Davor wrote:

Anyone? Someone?


Cheers,

Davor


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

It’s OK. Thank you anyway.

Sincerely,

Davor

On Thursday, November 14, 2013 10:20:03 PM UTC+1, Renger van Nieuwkoop wrote:

Sorry, I didn’t got the picture.



From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Davor
Sent: Donnerstag, 14. November 2013 21:44
To: gams...@googlegroups.com
Subject: Re: Beginners question



Thank you Ranger and sorry if I didn’t make myself clear.



I am trying to write Equation which I showed on picture in this code (I hope that you can see picture attached). Equation can be equal to zero it doesn’t matter now. I can’t make syntax to work.



Cheers,



Davor

On Thursday, November 14, 2013 9:17:06 PM UTC+1, Renger van Nieuwkoop wrote:

Hi Davor

Read the forum rules and ask a question that makes sense to us. You just show code that is running fine.

Renger




\


Modelworks

Gewerbestrasse 15

3600 Thun – Switzerland

+41 79 818 53 73

In…@modelworks.ch

blog.modelworks.ch





From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Davor
Sent: Donnerstag, 14. November 2013 17:25
To: gams...@googlegroups.com
Subject: Re: Beginners question



Anyone? Someone?





Cheers,



Davor


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.