Whenever you are modeling some situation in real life, you will typically find there are one or more sets of related objects. Examples would be such things as factories, customers, vehicles, and employees. Usually, if a constraint applies to one member of a set, then it will apply equally to each other member of the set. This simple concept is at the core of the LINGO modeling language. LINGO allows you to define the sets of related objects in the sets section. The sets section begins with the keyword SETS: on a line by itself and ends with ENDSETS on a line by itself. Once your set members are defined, LINGO has a group of set looping functions (e.g., @FOR), which apply operations to all members of a set using a single statement. See Using Sets for more information.

In the case of our Wireless Widget model, we have constructed the following three sets:

warehouses,
vendors, and
shipping arcs from each warehouse to customer.

The three sets are defined in the model's sets section as follows:

SETS:

  WAREHOUSES: CAPACITY;

  VENDORS: DEMAND;

  LINKS( WAREHOUSES, VENDORS): COST, VOLUME;

ENDSETS

The second line says that the set WAREHOUSES has an attribute called CAPACITY. The following line declares the vendor set and that it has an attribute called DEMAND.

The final set, titled LINKS, represents the links in the shipping network. Each link has a COST and a VOLUME attribute associated with it. The syntax used to define this set differs from the previous two. By specifying:

LINKS( WAREHOUSES, VENDORS)

we are telling LINGO that the LINKS set is derived from the WAREHOUSES and VENDORS sets. In this case, LINGO generates each ordered (warehouse, vendor) pair. Each of these 48 ordered pairs becomes a member in the LINKS set. To help clarify this, we list selected members from the LINKS set in the following table.

Member Index

Shipping Arc

1

WH1ààV1

2

WH1ààV2

3

WH1ààV3

47

WH6ààV7

48

WH6ààV8

A nice feature of LINGO is that it will automatically generate the members of the LINKS set based on the members of the WAREHOUSES and VENDORS sets, thereby saving us considerable work.