7.2 Data Vectors

Data vectors are used when the coefficients come in lists or tables of numerical data. They can be specified as lists of numbers in the model file or retrieved from an external file. With both methods you must specify the name of the datavector and the indexes that define the domain of the vector. To specify the indexes used, list the index names in brackets immediately after the vector name and separate them with commas.

The simplest way to define the values of the datavector is to enter them as a list of numbers directly after an assignment symbol. Surround the list with parentheses and separate each number by either space, comma, or both. To enter a zero value, you can alternatively enter only the comma to reduce typing.

Examples:

    DATA
       Price[product]         :=  (105.09, 234.00, 800.00);
       ProdCapacity[product]  :=  1000 (105, 42, 14);

Here price is a vector over one dimension product. Because there are three products, a list of three numbers is given. There must be enough numbers to satisfy the size of the vector, but additional values are allowed and simply ignored.

In ProductionCapacity 1000 is used as a multiplier. The actual values for the vector will be (105000, 42000, 14000).

Alternatively, you can put a multiplier in front of the parentheses and it is then applied to each number in the list. This feature reduces typing and increases the models readability.

As an additional feature, when defining a datavector, constant formulas can be used instead of just numbers for the elements. This includes features such as products, fractions, and arithmetic functions. Here is an example:

    A[i] := (2, -4+3, 2*SQR(3)+2, 1/(2+1), last(i))

When specifying tables of two or more dimensions, you can use just one set of parentheses for the whole list or use new parentheses for each dimension.

    C[i,j]  :=  (4,2,5,6,     or    C[i,j]  :=  ((4,2,5,6),
                 8,3,8,4,                        (8,3,8,4),
                 3,6,1,0);                       (3,6,1,0));

Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page