Page 1 of 1

how to set value only for a parameter's first dimension

Posted: Wed Mar 27, 2019 9:47 pm
by joe_sonic
I have a parameter, say demand, which is over two dimensions
Set t;
Set usage /elc, gas/;
Parameter demand(t,usage);
$include test.inc

Now, I want to create a .inc file, where I want to set value for demand, BUT, at first only for 'elc'. I tried this:

*test.inc...
Parameter demand(t,'elc')
\
1 1.0
2 2.0
3 3.0
... (skipped)
1200 1200.0
\;

however, it doesn't work. Can some one kindly tell me what is the correct syntax?
Thanks!

Re: how to set value only for a parameter's first dimension

Posted: Tue Apr 09, 2019 8:27 am
by Fred
Hi,

Your code snippet has so many flaws, that I think it might be a good idea if you look at introductory material like the tutorial first: https://www.gams.com/latest/docs/UG_Tutorial.html

If you want to define values for parameter demand for 'elc' only, you could do this for example as follows:

Code: Select all

parameter demand(t,usage) /
1.'elc' 1.0
2.'elc' 2.0
3.'elc' 3.0
/;
I hope this helps!

Fred