0% found this document useful (0 votes)
226 views3 pages

Transportation LP Using Excel and LINGO: The Cost Matrix

This document describes using Excel and LINGO to solve a transportation linear programming problem. It provides the cost matrix for transporting goods from 3 warehouses to 4 customers. It then shows the LINGO script that sets up the transportation model using the data from Excel, minimizes total cost, and returns the optimal solution back to Excel. It concludes with some notes about properly setting up the integration between Excel and LINGO.

Uploaded by

Adzi PlanoHolic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
226 views3 pages

Transportation LP Using Excel and LINGO: The Cost Matrix

This document describes using Excel and LINGO to solve a transportation linear programming problem. It provides the cost matrix for transporting goods from 3 warehouses to 4 customers. It then shows the LINGO script that sets up the transportation model using the data from Excel, minimizes total cost, and returns the optimal solution back to Excel. It concludes with some notes about properly setting up the integration between Excel and LINGO.

Uploaded by

Adzi PlanoHolic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLS, PDF, TXT or read online on Scribd
You are on page 1/ 3

Transportation LP Using Excel and LINGO

The cost matrix


Capacity CustA CustB CustC CustD
Demand: 4 7 5 3
Wh1 10 2 6 4 3
Wh2 15 6 6 3 6
Wh3 11 5 3 4 5
0 <= Solution status.
0 is OK, else see lingo.log
TotCost= 53 Recommended Shipments
Wh1 0 0 0 0
Wh2 0 0 0 0
Wh3 0 0 0 0
LINGO Script

MODEL:
SETS:
SOURCE: CAPACITY;
DEST: DEMAND;
SXD( SOURCE, DEST): COST, X;
ENDSETS
DATA:
! Get data from currently open spreadsheet;
SOURCE = @OLE( );
DEST = @OLE( );
COST = @OLE( );
CAPACITY = @OLE( );
DEMAND = @OLE( );
ENDDATA
MIN = TOTCOST;
TOTCOST = @SUM( SXD(I,J): COST(I,J)*X(I,J));
@FOR( SOURCE(I):
@SUM( SXD(I,J): X(I,J)) <= CAPACITY(I);
);
@FOR( DEST(J):
@SUM( SXD(I,J): X(I,J)) = DEMAND(J);
);
DATA: ! Put results back in spreadsheet;
@OLE( ) = @STATUS();
@OLE( ) = X;
@OLE( ) = TOTCOST;
ENDDATA
END
GO
QUIT

Page 2
1) You may have to set your security level( Tools | Options | Security | Macro Security) to Low,
( or Tools | Macro | Security on older versions),
in order to get Excel to tolerate the macro that is used to run the model.
2) If you add a new row, be sure that you do the Insert | Row in the
strict interior of the list of the current rows section(s), so that ranges get expanded.
If you insert a row at the edge of a range, the new row will not be included
in the range. The LINGO model knows what a datum means based upon the range in which
it appears.
3) If you add a new column, be sure that you do the Insert | Column in the
strict interior, etc.
4) If there seems to be an error in the execution of the model, then look at
the file, lingo.log.

5) You should only have one spreadsheet open at once. Unless you specifically
supply a spreadsheet name, the LINGO model gets its data from the (only)
open .xls file.

You might also like