******* 1

solving the transportation problem and
Assignment problem by using lingo software
Example 15: A manufacturer has 4 warehouses and 5 vendors all in different cities. In
the first warehouse there are 50 products, in the second warehouse there are 70
products, in the third warehouse there are 90 products and in the fourth warehouse
there are 90 products. Demand of the first vendor is 80 products, demand of the second
vendor is 50 products, demand of the third vendor is 60 products, demand of the fourth
vendor is 70 products and demand of the fifth vendor is 40 products. Unit
transportation costs from the warehouse to the vendor are given in the following table.
The objective function :
by using mathematical notation, you can express the objective function
equation as following:
Xij
In a similar manner, LINGO’s modeling language allows you to express the
objective function in a form that is short, easy to type, and easy to
understand. The equivalent LINGO statement is:
MIN = @SUM(LINKS(I,J): COST(I,J) * X(I,J));
The following table compares the mathematical notation to the LINGO syntax
for our objective function:
Xij
X
The Constraints:
Starting with the demand constraint for Vendor 1, we need to sum up the
shipments from all the warehouses to Vendor 1 and set them equal to
Vendor 1’s demand of 80 UNITS
Using mathematical notation, all fıve demand constraints can be expressed in
the single statement:
Xij
The corresponding LINGO modeling statement as
@FOR(VENDORS(J):
@SUM(WAREHOUSES(I): X(I, J)) = DEMAND(J));
Xij
x
•
Now, we will move on to constructing the capacity constraints. In standard mathematical
notation, the four capacity constraints would be expressed as:
Xij
<
The equivalent LINGO statement for all capacity constraints would be:
• The equivalent LINGO statement for all capacity constraints would be:
@FOR(WAREHOUSES(I):
@SUM(VENDORS(J): x(I, J))<= CAPACITY(I));
Putting together everything we’ve done so far yields the following
complete LINGO model:
MODEL:
MIN = @SUM(LINKS(I, J):
COST(I, J) * x(I, J));
@FOR(VENDORS(J):
@SUM(WAREHOUSES(I): x(I, J)) =
DEMAND(J));
@FOR(WAREHOUSES(I):
@SUM(VENDORS(J): x(I, J)) <=
CAPACITY(I));
END
• Solving the Transportation Model
• Now, let’s solve the model to determine the optimal shipping volume for
each warehouse to vendor link. In LINGO for Windows, choose Solve
from the LINGO menu or press the Solve button .
• Note: To obtain a report containing only the nonzero values for x, we select
the Solution command from the LINGO menu. We are then presented with
the following dialog box:
x
Press down on the arrow button in the Attribute or Row Name field and select x
from the list of names in the drop-down box.
Example: Suppose that we have 5 jobs (1, 2, 3, 4, 5) waiting for being
performed and 5 machines (A, B, C, D, E) that can be used to perform
these jobs. The assignment costs of the jobs to the machines are given in
the following table. Find the minimum total cost one-to-one assignment
between the jobs and the machines by the Hungarian Method.
SETS
JOBS / J1 J2 J3 J4 J5 /;
MACHINE / A B C D E / ;
LINKS(JOBS , MACHINE): COST, X;
ENDSETS
The objective
MIN = @SUM( LINKS( I, J):
COST( I, J) * X( I, J));
The demand constraints
@FOR( JOBS( I):
@SUM( MACHINE (J): X( I, J)) =1);
The capacity constraints
@FOR( MACHINE (J):
@SUM( JOBS ( I): X( I, J)) =1
The data
DATA:
COST = 9 6 3 3 4
45697
7 8 11 2 8
6 7 12 5 13
45649;
ENDDATA
END