You are on page 1of 26

Outline

Introduction

Linear Programming Model

References

IFC6503C - Operations Research


Session 7: Transportation Problem (Part 1)

Daniel Febrian Sengkey


Undergraduate Program of Informatics Engineering
Department of Electrical Engineering
Faculty of Engineering
Universitas Sam Ratulangi

IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Outline

Outline
Introduction
The Transportation Problem
Illustration: The Foster Generators Problem
Linear Programming Model
LP Model for Foster Generators Transportation Problem
Computer Solution
References

IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Acknowledgement

The explanation about transportation problem


and the Foster Generators example are adapted
from [1].

IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

The Transportation Problem

Introduction

IFC6503C

Transportation problem belongs to a special class of linear


programming called Network Flow problems.

The transportation problem arises frequently in planning for


the distribution of goods and services from several supply
locations to several demand locations.

Typically the goods quantity at each supply location (origin)


is limited, and the quantity of goods needed at each of several
locations (destinations) is known.

The common objective in transportation problem is to


minimize the cost of shipping (transporting) goods from the
origin to the destinations.

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem
I
I
I
I

Foster Generators is a generator manufacturer.


It has three plants, and four distribution centers.
It operates plants in Cleveland, Ohio; Bedford, Indiana; and
York, Pennsylvania.
Production capacities over the next three-month planning
period for one particular type of generator are as follows:
Table 1 : Production capacities for next three-month period.

Origin
1
2
3
IFC6503C

Plant
Cleveland
Bedford
York

Prod. Capacity (units)


5,000
6,000
2,500
Total: 13,500
PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem
I

The firm distributes its generators through four regional


distribution centers located in Boston, Chicago, St. Louis, and
Lexington.
The three-month forecast of demand for the distribution
centers is as follows:
Table 2 : Production capacities for next three-month period.

Destination
1
2
3
4
IFC6503C

Distribution
Center
Boston
Chicago
St. Louis
Lexington

Demand Forecast
(units)
6,000
4,000
2,000
1,500
Total: 13,500
PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

IFC6503C

Management would like to determine how much of its


production should be shipped from each plant to each
distribution center.

Figure 1 shows the graphical representation of the 12


distribution routes Foster can use.

Such a graph is called network.

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

3
5000

1
Cleveland

1
Boston

6000

2
Chicago

4000

3
St. Louis

2500

4
Lexington

1500

2
7
6
7
5

6000

2
Bedford

2
3
2
5

2500

Supplies

3
York

4
5

Distribution Routes
(arcs)

Demands

Figure 1 : Network Representation


IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

IFC6503C

The circles are referred to as nodes.

The lines connecting the nodes are arcs.

Each origin and destination is represented by a node, and each


possible shipping route represented by an arc.

The amount of supply is written next to each destination


node, and the amount of demand is written next to each
destination node.

The goods shipped from the origins to destinations represent


the flow in the network, the direction indicated by the arrows.

The cost for each unit shipped on each route is shown in


Table 3.
PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

Table 3 : Transportation cost per unit.

Origin
Cleveland
Bedford
York

IFC6503C

Boston
3
7
2

Destination
Chicago St. Louis
2
7
5
2
5
4

Lexington
6
3
5

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

A linear programming model can be used to solve this


transportation problem.
We use double-subscripted variables as the decision variables.
I

IFC6503C

For m origins and n destinations the decision variables are


written as
xij = number of units shipped from origin i to destination j,
where i = 1, 2, . . . , m and j = 1, 2, . . . , n
Example: x11 is the number of units shipped from origin 1
(Cleveland) to destination 1 (Boston).
Example: x12 is the number of units shipped from origin 1
(Cleveland) to destination 2 (Chicago).

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem
I
I

Remember that the objective of the transportation problems is


to minimize the total transportation cost
Therefore we can use the cost data in Table 3
I

Transportation costs for units shipped from Cleveland =


3x11 + 2x12 + 7x13 + 6x14
Transportation costs for units shipped from Bedford =
7x21 + 5x22 + 2x23 + 3x24
Transportation costs for units shipped from York =
2x31 + 5x32 + 4x33 + 5x34

The sum of these expressions provides the objective function


showing the total transportation cost for Foster Generators.

3x11 +2x12 +7x13 +6x14 +7x21 +5x22 +2x23 +3x24 +2x31 +5x32 +4x33 +5x34
IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

Transportation problems need constraints because each origin


has a limited supply and each destination has a demand
requirement.

With three origins (plants), the Foster transportation problem


has three supply constraints.
The supply constraints are:

I
I
I

IFC6503C

x11 + x12 + x13 + x14 5, 000 Cleveland supply.


x21 + x22 + x23 + x24 6, 000 Bedford supply.
x31 + x32 + x33 + x34 2, 500 York supply.

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

With four distribution centers (destinations), four demand


constraints are needed.
The demand constraints are:
I
I
I
I

IFC6503C

x11 + x21 + x31


x12 + x22 + x32
x13 + x23 + x33
x14 + x24 + x34

= 6, 000
= 4, 000
= 2, 000
= 1, 500

Boston demand.
Chicago demand.
St. Louis demand.
Lexington demand.

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Illustration
The Foster Generators Problem

Min.
3x11 +2x12 +7x13 +6x14 +7x21 +5x22 +2x23 +3x24 +2x31 +5x32 +4x33 +5x34
s.t
x11 + x12 + x13 + x14 5, 000
x21 + x22 + x23 + x24 6, 000
x31 + x32 + x33 + x34 2, 500
x11 + x21 + x31 = 6, 000
x12 + x22 + x32 = 4, 000
x13 + x23 + x33 = 2, 000
x14 + x24 + x34 = 1, 500
xij 0 for i = 1, 2, 3 and j = 1, 2, 3, 4
IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Illustration

Transportation Problem
A General Linear Programming Model

Minimize

n
m X
X

cij xij

i=1 j=1

subject to
n
X
j=1
m
X

xij si

i = 1, 2, . . . , m

Supply

xij = dj

i = 1, 2, . . . , n

Demmand

i=1

xij 0
IFC6503C

for all i and j


PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

Computer Solution

IFC6503C

There are several known methods to solve transportation.

The first, and the easiest solution is by using computer


software.

Since we can express transportation problem in linear


programming model, therefore we can use GLPK to solve it.

Start with extracting the coefficients and write them in a


matrix.

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

The Foster Generators Problem


System of Equations

Min.
3x11 +2x12 +7x13 +6x14 +7x21 +5x22 +2x23 +3x24 +2x31 +5x32 +4x33 +5x34
s.t
x11 + x12 + x13 + x14 5, 000
x21 + x22 + x23 + x24 6, 000
x31 + x32 + x33 + x34 2, 500
x11 + x21 + x31 = 6, 000
x12 + x22 + x32 = 4, 000
x13 + x23 + x33 = 2, 000
x14 + x24 + x34 = 1, 500
xij 0 for i = 1, 2, 3 and j = 1, 2, 3, 4
IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

Constraints in Tabular Form

Table 4 : Foster Generators transportation problem constraints coefficients.

x11
1
0
0
1
0
0
0

IFC6503C

x12
1
0
0
0
1
0
0

x13
1
0
0
0
0
1
0

x14
1
0
0
0
0
0
1

x21
0
1
0
1
0
0
0

x22
0
1
0
0
1
0
0

x23
0
1
0
0
0
1
0

x24
0
1
0
0
0
0
1

x31
0
0
1
1
0
0
0

x32
0
0
1
0
1
0
0

x33
0
0
1
0
0
1
0

x34
0
0
1
0
0
0
1

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

Assigning Variables
Assign the coeffients of the constraints to a matrix.
mat <c(
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
),
nrow
)
IFC6503C

matrix(
0,
0,
0,
0,
1,
1,
1,
1,
0,
0,
0,
0,

0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,

1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,

0,
1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,

0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
1,
0,

0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
1

= 7

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

Assigning Variables
x11
1
0
0
1
0
0
0

x12
1
0
0
0
1
0
0

x13
1
0
0
0
0
1
0

x14
1
0
0
0
0
0
1

x21
0
1
0
1
0
0
0

x22
0
1
0
0
1
0
0

x23
0
1
0
0
0
1
0

x24
0
1
0
0
0
0
1

x31
0
0
1
1
0
0
0

x32
0
0
1
0
1
0
0

x33
0
0
1
0
0
1
0

x34
0
0
1
0
0
0
1

mat
##
##
##
##
##
##
##
##

IFC6503C

[1,]
[2,]
[3,]
[4,]
[5,]
[6,]
[7,]

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
1

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

Assigning Variables

Assign the right side values to a variable.


rhs <- c(5000, 6000, 2500, 6000, 4000, 2000, 1500)

Assign the directions of the constraints to a variable.


dir <- c("<=", "<=", "<=", "==", "==", "==", "==")

Assign the coeffients of the objective function to a variable.


3x11 + 2x12 + 7x13 + 6x14 + 7x21 + 5x22 + 2x23 + 3x24 + 2x31 +
5x32 + 4x33 + 5x34
obj <- c(3, 2, 7, 6, 7, 5, 2, 3, 2, 5, 4, 5)

IFC6503C

PSTI UNSRAT

Solving LP using Rglpk


Do not forget to load the Rglpk package before using
Rglpk solve LP().
library(Rglpk)
## Loading required package: slam
## Using the GLPK callable library version 4.52
Rglpk_solve_LP(obj=obj, mat=mat, dir=dir, rhs=rhs, max = F)
##
##
##
##
##
##
##
##
##

$optimum
[1] 39500
$solution
[1] 3500 1500
[12]
0
$status
[1] 0

0 2500 2000 1500 2500

Outline

Introduction

Linear Programming Model

References

Computer Solution

Conclusion
The Optimal Solution

Based on the results of the software calculation, the optimal


solution to the Foster Generators transportation problem is as shon
in Table 5.

IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

Computer Solution

Conclusion
The Optimal Solution

Table 5 : Optimal solution of Foster Generators transportation problem.

Variable1

From

To

x11
x12
x22
x23
x24
x31

Cleveland
Cleveland
Bedford
Bedford
Bedford
York

Boston
Chicago
Chicago
St. Louis
Lexington
Boston

Units
Shipped
3500
1500
2500
2000
1500
2500

Cost
per Unit ($)
3
2
5
2
3
2
Total

Total Cost
($)
10,500
3,000
12,500
4,000
4,500
5,000
39,500

Actually, the Variable column is not a part of the solution. It is added only
to ease the comparison with the linear model.
IFC6503C

PSTI UNSRAT

Outline

Introduction

Linear Programming Model

References

References I

[1] D. R. Anderson, D. J. Sweeney, T. A. Williams, J. D. Camm, and


K. Martin, An Introduction to Management Science: Quantitative
Approaches to Decision Making, revised 13th ed. OH:
South-Western/Cengage Learning, 2012.

IFC6503C

PSTI UNSRAT

You might also like