Initializing an Attribute to a Single Value

Suppose you want to fix all the elements of an attribute to a single value. You can do this by entering a single value on the right-hand side of the data statement. LINGO will initialize all the elements of the attribute to this value. To perform what if analsis on the attribute, initialize it to a single question mark, and LINGO will prompt you for the values of all the members of the attribute each time the model is solved.

As an example, consider the following excerpt from a model:

SETS:

  DAYS / MO, TU, WE, TH, FR, SA, SU/:

   NEEDS;

ENDSETS

 

DATA:

  NEEDS = 20;

ENDDATA

LINGO will initialize all the members of the NEEDS attribute to the value 20.

If there are multiple attributes on the left-hand side of the data statement, you will need one value on the right-hand side for each attribute on the left. For instance, let's extend the previous example, so we have an additional attribute called COST:

SETS:

  DAYS / MO, TU, WE, TH, FR, SA, SU/:

   NEEDS, COST;

ENDSETS

 

DATA:

  NEEDS, COST = 20, 100;

ENDDATA

All seven members of NEEDS will be initialized to 20 and all seven members of COST will be 100.