Understanding Lingo derived sets

389 views Asked by At

I am completely new to LINGO and I found this example in LINGO.
MODEL:

! A 6 Warehouse 8 Vendor Transportation Problem;
SETS:
WAREHOUSES / WH1 WH2 WH3 WH4 WH5 WH6/: CAPACITY;
VENDORS / V1 V2 V3 V4 V5 V6 V7 V8/ : DEMAND;
LINKS( WAREHOUSES, VENDORS): COST, VOLUME;
ENDSETS
! The objective;
MIN = @SUM( LINKS( I, J):
COST( I, J) * VOLUME( I, J));
! The demand constraints;
@FOR( VENDORS( J):
@SUM( WAREHOUSES( I): VOLUME( I, J)) =
DEMAND( J));
! The capacity constraints;
@FOR( WAREHOUSES( I):
@SUM( VENDORS( J): VOLUME( I, J)) <=
CAPACITY( I));
! Here is the data;
DATA:
CAPACITY = 60 55 51 43 41 52;
DEMAND = 35 37 22 32 41 32 43 38;
COST = 6 2 6 7 4 2 5 9
4 9 5 3 8 5 8 2
5 2 1 9 7 4 3 3
7 6 7 3 9 2 7 1
2 3 9 5 7 2 6 5
5 5 2 2 8 1 4 3;
ENDDATA
END

I have several things that I don't understand in this code.
enter image description here

  1. In the derived set LINKS( WAREHOUSES, VENDORS): COST, VOLUME; how does it know that LINKS members should be as V1WH1,V1WH2,..,V1WH6,V2WH1,V2WH2,...,V6WH6,...,V8WH1,...,V8WH6.
    That is how does it know that each vendor is connected to all the warehouses when it is specified by LINKS( WAREHOUSES, VENDORS): COST, VOLUME;

  2. Is Volume data given in this?How has it obtained it?

1

There are 1 answers

0
Honza Osobne On BEST ANSWER

I used to work a bit with Lingo long time ago. Things have changed since, but I have looked up their user manual (Lingo 14) - see page 31, it explains how the SETS definition works.

1) All the set members of the cartesian product WAREHOUSES x PRODUCTS are generated automatically (by concatenating the labels, considering all 'combinations').

Now, if certain pair warehouse-vendor should not be connected, its COST parameter should be left undefined. Look for 'Omitting Values in a Data Section' in the user manual, page 118. You need to use commas as separators in the COST matrix and use an empty field (e.g. 5, 5, , 6...).

2) VOLUME is a variable, not a parameter. The values of VOLUME are to be found by the solver - they will represent the optimal shipment volumes (where every vendor will get what he/she demands, and the total cost of the shipping will be minimal).