manpagez: man pages & more
info gmpl
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3 Parameter data block

param name , record ,, record ;

param name default value , record ,, record ;

param : tabbing-data ;

param default value : tabbing-data ;

Where:

name is a symbolic name of the parameter;

value is an optional default value of the parameter;

record, …, record are data records.

tabbing-data specifies parameter data in the tabbing format.

Note:

Commae preceding data records may be omitted.

Data records:

:=

is a non-significant data record which may be used freely to improve readability;

[ slice ]

specifies a slice;

plain-data

specifies parameter data in the plain format;

: tabular-data

specifies parameter data in the tabular format;

(tr) : tabular-data

specifies parameter data in the transposed tabular format. (In this case the colon following the keyword (tr) may be omitted.)

Examples

 
param T := 4;
param month := 1 Jan 2 Feb 3 Mar 4 Apr 5 May;
param month := [1] 'Jan', [2] 'Feb', [3] 'Mar', [4] 'Apr', [5] 'May';
param init_stock := iron 7.32 nickel 35.8;
param init_stock [*] iron 7.32, nickel 35.8;
param cost [iron] .025 [nickel] .03;
param value := iron -.1, nickel .02;
param       : init_stock  cost  value :=
      iron       7.32     .025   -.1
      nickel    35.8      .03     .02 ;
param : raw : init stock  cost  value :=
        iron     7.32     .025   -.1
        nickel  35.8      .03     .02 ;
param demand default 0 (tr)
       :  FRA  DET  LAN  WIN  STL  FRE  LAF :=
   bands  300   .   100   75   .   225  250
   coils  500  750  400  250   .   850  500
   plate  100   .    .    50  200   .   250 ;
param trans_cost :=
   [*,*,bands]:  FRA  DET  LAN  WIN  STL  FRE  LAF :=
         GARY     30   10    8   10   11   71    6
         CLEV     22    7   10    7   21   82   13
         PITT     19   11   12   10   25   83   15
   [*,*,coils]:  FRA  DET  LAN  WIN  STL  FRE  LAF :=
         GARY     39   14   11   14   16   82    8
         CLEV     27    9   12    9   26   95   17
         PITT     24   14   17   13   28   99   20
   [*,*,plate]:  FRA  DET  LAN  WIN  STL  FRE  LAF :=
         GARY     41   15   12   16   17   86    8
         CLEV     29    9   13    9   28   99   18
         PITT     26   14   17   13   31  104   20 ;

The parameter data block is used to specify complete data for a parameter (or parameters, if data are specified in the tabbing format) whose name is given in the block.

Data blocks can be specified only for the parameters, which are non-computable, i.e. which have no assign attribute in the corresponding parameter statements.

Data defined in the parameter data block are coded as a sequence of data records described below. Additionally the data block can be provided with the optional default attribute, which specifies a default numeric or symbolic value of the parameter (parameters). This default value is assigned to the parameter or its members, if no appropriate value is defined in the parameter data block. The default attribute cannot be used, if it is already specified in the corresponding parameter statement(s).

Assign data record

The assign (:=) data record is a non-signficant element. It may be used for improving readability of data blocks.

Slice data record

The slice data record is a control record which specifies a slice of the parameter array. It has the following syntactic form:

[ s1 , s2 ,, sn ]

where s1, s2, …, sn are components of the slice.

Each component of the slice can be a number or symbol or the asterisk (|*|). The number of components in the slice must be the same as the dimension of the parameter. For instance, if the parameter is a 4-dimensional array, the slice must have four components. The number of asterisks in the slice is called slice dimension.

The effect of using slices is the following. If a m-dimensional slice (i.e. a slice which has m asterisks) is specified in the data block, all subsequent data records must specify subscripts of the parameter members as if the parameter were m-dimensional, not n-dimensional.

Whenever m subscripts are encountered, each asterisk in the slice is replaced by corresponding subscript that gives n subscripts, which define the actual parameter member. For example, if the slice [a,*,1,2,*] is in effect, and the subscripts 3 and b are encountered in a subsequent data record, the complete subscript list used to choose a parameter member is [a,3,1,2,b].

It is allowed to specify a slice that has no asterisks. Such slice itself defines a complete subscript list, in which case the next data record can define only a single value of the corresponding parameter member.

Being once specified the slice effects until either a new slice or the end of data block has been encountered. Note that if there is no slice specified in the data block, a dummy one, components of which are all asterisks, is assumed.

Plain data record

The plain data record defines the subscript list and a single value in plain format. This record has the following syntactic form:

t1 , t2 ,, tn , v

where t1, t2, …, tn are subscripts, v is a value. Each subscript as well as the value can be a number or symbol. Commae following subscripts are optional and may be omitted.

In case of 0-dimensional parameter or slice the plain data record have no subscripts and consists of a single value only.

Tabular data record

The tabular data record defines several values, where each value is provided with two subscripts. This record has the following syntactic form:

:

c1

c2

cn

:=

r1

a11

a12

a1n

r2

a21

a22

a2n

rm

am1

am2

amn

where r1, r2, …, rm are numbers and/or symbols which correspond to rows of the table, c1, c2, …, cn are numbers and/or symbols which correspond to columns of the table, a11, a12, …, amn are the table elements. Each element can be a number or symbol or the single decimal point. (In this data record the delimiter : preceding the column list and the delimiter := following the column list cannot be omitted.)

Each element aij of the tabular data block (1 <= i <= m, 1 <= j <= n) defines two subscripts, where the first subscript is ri, and the second one is cj. These subscripts are used in conjunction with the current slice to form the complete subscript list which identifies a particular member of the parameter array. If aij is a number or symbol, this value is assigned to the parameter member. However, if aij is the single decimal point, the member is assigned a default value specified either in the parameter data block or in the parameter statement, or, if no default value is specified, the member remains undefined.

Since the tabular data record provides two subscripts for each value, either the parameter or the slice currently used must be 2-dimensional.

Transposed tabular data record

The transposed tabular data record has the following syntactic form:

(tr) :

c1

c2

cn

:=

r1

a11

a12

a1n

r2

a21

a22

a2n

rm

am1

am2

amn

(In this case the delimiter : following the keyword (tr) is optional and may be omitted.)

This data record is completely analogous to the tabular data record (see above) with the only exception that the first subscript defined by the element aij is cj while the second one is ri.

Being once specified the (tr) indicator effects on all subsequent data records until either a slice or the end of data block has been encountered.

Tabbing data format

The parameter data block in the tabbing format has the following syntactic form:

 
param default value : s :  p1 ,  p2 , ...,  pk :=
t11 , t12 , ... , t1n ,   a11 , a12 , ..., a1k
t21 , t22 , ... , t2n ,   a21 , a22 , ..., a2k
  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
tm1 , tm2 , ... , tmn ,   am1 , am2 , ..., amk ;
Note:

The keyword default may be omitted along with a value following it.

The symbolic name s of a set may be omitted along with the colon following it.

All comae are optional and may be omitted.

The data block in the tabbing format shown above is exactly equivalent to the following data blocks:

 
set s := (t11,...,t1n) (t21,...,t2n) ... (tm1,...,tmn)

param pj default value :=
         [t11,...,t1n] a1j [t21,...,t2n] a2j ... [tm1,...,tmn] amj;

where j = 1, 2, …, k.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.