Parameters

Top  Previous  Next

Parameter format is used to enter items defined with respect to sets.  Parameter format is most commonly used with data items that are dependent on only one set (a vector) although multi set cases can be entered.

The general format for parameter entry is:

 

Parameter

 itemname(setdependency)  optional explanatory text

      /first set element name   associated value,                        

       second set element name  associated value,

                                 ...        /;

or

Parameters

 itemname(setdependency)  optional explanatory text

      /first set element name   associated value,                        

       second set element name  associated value,

                                 ...        /;

Examples:

(Parameter.gms)

PARAMETERc(j)      / x1     3    ,x2   2 ,x3    0.5/

 b(i)     / r1 10

 r2 3/;

PARAMETER

 PRICE(PROCESS)     PRODUCT PRICES BY PROCESS

                 /X1 3,X2 2,X3 0.5/;

 RESORAVAIL(RESOURCE)  RESOURCE AVAIL

                 /CONSTRAIN1 10 ,CONSTRAIN2 3/;

Parametermultd(i,j,k) three dimension /

 i1.j1.k1 10 ,

 i2.j1.k2 90 /;

parameterscc(j), cb(i) /i1 2/;

parameter    hh(j) define all elements to 10 /set.j 10/;

Notes:

Item names, the contained set element names plus the explanatory text must obey the rules presented in the Rules for Item Names, Element names and Explanatory Text chapter.
Explanatory text and long explanatory parameter names should be used where possible as argued in the Writing Models and Good Modeling Practices chapter.
PARAMETER or PARAMETERS can be used interchangeably.
More than one named item is definable under a single parameter statement with a semicolon terminating the total statement.
Multiple named items can be defined in a line of a parameter statement set off with commas.
Data do not have to be entered in the parameter statement, but rather can be defined later with replacement (=) statement calculations or assignments.
Items can be defined over up to 20 sets and thus one named item may be associated with numerous individual numerical values for elements of the parameter, each associated with a specific simultaneous collection of set elements for each of the named sets.
When multi set dependent named items are entered then the notation is set1elementname.set2elementname.set3elementname etc with periods(.) setting off the element names in the associated sets.
All elements that are not given explicit values are implicitly assigned with a value of zero.
Multiple entries can occur within one command using notation such as

 Parameter a(i) /(i1,i5) 3,(i6*i11) 5/;

 

The referenced set elements must appear in the set the named item is defined over.
Data for an element can only be defined once in a parameter statement.
Parameters are an all-encompassing data class in GAMS into which data are kept including data entered as Scalars and Table.  Parameters may also contain acronyms.
One can specify values for all elements in a set using the set reference set.setname as in definition of hh above.