0

I defined a set in GAMS to represent users number. I need to use the set multiple times to define transmission power for each user, the channel quality...etc. However, I think in GAMS you can not use the name of the set for different variables, My question is do I need to define a different set for each variable?

Code example:

set I number of users    /i1,i2/ ;

Parameters

CP(I) circuit power per user  /
i1  10
i2  10 /

h(I)  channel quality /

i1 48.9318

i2 106.2280/ ;

Thank you in advance for any help or for any hints.

Meriame
  • 11
  • 5

1 Answers1

0

No, you don't need to define different sets if you always want to refer to the same elements (users in your case). It is actually the idea of sets to do exactly this. So, your example code is just right.

You can also look at a simple example like this one here: http://www.gams.com/modlib/libhtml/trnsport.htm

There you will see, that the sets i and j are used all over for different parameters, variables and equations.

I hope that helps, Lutz

Lutz
  • 2,197
  • 1
  • 10
  • 12
  • thank you very much for your reply and for the example. I have one more question if you may help. how do I initialize a point and where? I tried to do the following in ivariables scope but I got errors: P(I) transmission power per user / i1 3.2 i2 4.5/ – Meriame May 23 '16 at 14:29
  • Hi, I guess you got you answer now [here](http://stackoverflow.com/questions/37395407/initialize-decesion-varibales-in-gams-which-in-form-of-a-set-equation-erros), right? – Lutz May 24 '16 at 08:05