Using same index for different sets??

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

Using same index for different sets??

Post by Archiver »


Hello everyone,

we have to implement a model in GAMS. In this model we have a variable x with the indices i and j.
Our problem is, that i and j belong to different sets in different restrictions.

For example, i belongs to the set C in restriction (2) (please see below) but in restriction (5) it belongs to set N^k.

Our question is: How can we let GAMS know, which sets i and j have to belong to?

Thanks 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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

RE: Using same index for different sets??

Post by Archiver »


Hi Gitte



If you have the following



Set i /i1*i10/;



And C is a subset of I, say:



Set c(i) /i1,i2,i3/;



The variable X is defined over the complete set.



You can define an equation (must be over the complete set) as:



Equation my_equation(i) ;



But when you define the equation, you just use c as index:



My_equation(c)..

x(c) =E=1;



Hope this helps



Cheers

Renger



_________________________________________________________________

Dr. Renger van Nieuwkoop

Department of Management, Technology and Economics

Centre for Energy Policy and Economics

Swiss Federal Institute of Technology Zurich

Zürichbergstrasse 18, CH-8032 Zurich

Mobile: +41 79 818 53 73

E-Mail: rengerv@vannieuwkoop.ch



Director Modelworks

Goldiwilstrasse 16 F CH-3600 Thun

E-Mail: info@modelworks.ch

Blog: http://blog.modelworks.ch









From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Gitte van den Heuvel
Sent: Samstag, 16. Januar 2016 14:11
To: gamsworld
Subject: Using same index for different sets??



Hello everyone,

we have to implement a model in GAMS. In this model we have a variable x with the indices i and j.
Our problem is, that i and j belong to different sets in different restrictions.

For example, i belongs to the set C in restriction (2) (please see below) but in restriction (5) it belongs to set N^k.

Our question is: How can we let GAMS know, which sets i and j have to belong to?

Thanks 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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

--
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 https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Post Reply