0% found this document useful (0 votes)
3 views

Chapter 1 Linear Programming

Uploaded by

darafoster0211
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Chapter 1 Linear Programming

Uploaded by

darafoster0211
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

An introduction to Linear Programming

Chapter 1

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-1/44
Learning Objectives
The aims of this chapter are:

• To introduce the formulation and modelling of Linear Programming problems;

• To introduce the different mathematical statements of a Linear Programming problem and the
transformation rules to pass from one statement to another;

• To introduce some basic algebraical and geometrical notions used in Linear Programming;

• To introduce the use of a software package in R to solve Linear Programming problems;

• To interpret the obtained results after solving a Linear Programming problem.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-2/44
Learning Outcomes
By the end of this chapter, you should:

• Understand the basic concepts on the formulation of a Linear Programming model from the state-
ment of the problem;

• Be able to recognise a Linear Programming model;

• Be able to solve a Linear Programming problem using a software package in R;

• Be able to interpret the solution of a Linear Programming problem.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-3/44
Outline
♦ What’s a Linear Programming problem?

♦ Some definitions and terminologies in Linear Programming.

♦ Solving a Linear Programming problem.

♦ Particular Linear Programming problems: Transportation problems.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-4/44
What’s a Linear Programming Problem?
Definition 1. A Linear Programming (LP) problem consists of an optimisation problem involving
a linear function to be optimised subject to linear equality and/or inequality constraints.

Example 1.

A developer can build and sell two types of house: type A and type B. A house of type
A requires 10, 000 bricks, 4 doors and 5 windows, whereas a house of type B requires
8, 000 bricks, 2 doors and 10 windows. A house of type A can be sold for £200, 000 and
a house of type B can be sold for £250, 000. The developer has 168, 000 bricks, 60 doors
and 150 windows.
How many houses of each type should this developer build if he wants to maximise the
total selling price?

Formulation of the problem stated in Example 1

Let x1 and x2 be the numbers of houses of type A and B, respectively.

Objective: Maximise the total selling price z = £200, 000 × x1 + £250, 000 × x2.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-5/44
Constraints:

• Bricks: (10, 000 × x1) bricks + (8, 000 × x2) bricks ≤ 168, 000 bricks.
• Doors: (4 × x1) doors + (2 × x2) doors ≤ 60 doors.
• Windows: (5 × x1) windows + (10 × x2) windows ≤ 150 windows.
• Positivity: x1 ≥ 0 and x2 ≥ 0.

The mathematical model

Maximise z = 200, 000x1 + 250, 000x2


subject to 10, 000x1 + 8, 000x2 ≤ 168, 000
4x1 + 2x2 ≤ 60
5x1 + 10x2 ≤ 150
x1 ≥ 0
x2 ≥ 0

The variables x1 and x2 are called decision variables of the model, the function to be
maximised (z) is called the objective function of the model and the inequalities in the
model are referred to as the constraints of the model.
QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-6/44
Applications of Linear Programming

Linear programming is used to solve problems in many aspects of business administration


and engineering problems including:

• Manufacturing, Design;
• Transportation, Routing;
• Planning, Scheduling, Assignement, Restructuring;
• Distribution networks;
• Financial portfolios;

Formulation of a Linear Programming problem

One of the main challenges in linear programming lies in the formulation of the problem:
translating the problem statement into a system of linear equations and/or inequations to
be solved (i.e. the mathematical model). The information required to write the model is
derived from the problem statement and therefore depends on the problem in question.
Here are some guidelines to follow when formulating a model from a Linear Programming
problem statement:

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-7/44
1. Identify the objective to be achieved in the problem, i.e., which quantity is to be
optimised. For example, one may seek to maximise profit or to minimise the cost,
etc...
2. Identify the decision variables and the constraints on them. For example, produc-
tion quantities and production limits may serve as decision variables and constraints,
respectively.
3. Write the objective function and constraints in terms of the decision variables, by using
information from the problem statement to determine the proper coefficient for each
term. Discard any unnecessary and redundant information and make sure that each
variable in the objective function appears at least once in the constraints.
4. Add any implicit constraints, such as non-negative restrictions. For example, if there are
physical quantities that must be non-negative, then these constraints must be included
in the formulation.
5. Arrange the system of equations and/or inequations in a consistent form suitable for
solving. For example, place all variables on the left hand side of their equations or
inequations and list them in the order of their subscripts.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-8/44
Linear Programming assumptions

Linear programming requires linearity in the constraints and the objective function, i.e.,
each decision variable is multiplied by a constant coefficient. Linearity requires the follow-
ing assumptions:

• Proportionality: a change in a variable results in a proportionate change in that vari-


able’s contribution to the value of the function.
• Additivity: the function value is the sum of the contributions of each term.
• Divisibility: the decision variables can be divided into non-integer values, taking on
fractional values.

Additionally, linear programming assumes certainty, i.e., all the coefficients are known and
constant.

Remark 1.When the divisibility assumption does not hold, one resorts to Integer Programming
techniques to solve the problem.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-9/44
Mathematical statements of a LP

General structure of a LP
Pn
Optimise z = j=1 cj xj

Pn
subject to j=1 aij xj ≤ bi , i ∈ I ⊆ {1, . . . , m};
Pn
j=1 akj xj ≥ bk , k ∈ K ⊆ {1, . . . , m};
Pn
j=1 arj xj = br , r ∈ R ⊆ {1, . . . , m};

lj ≤ xj ≤ uj , j = 1, . . . , n.

• Optimise= Minimise or Maximise;


• I, K and R are disjunct and I ∪ K ∪ R = {1, . . . , m};
• lj , uj ∈ R ∪ {±∞};
• The coefficients cj , aij , akj , arj , bj , bk and br are given real constants.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-10/44
Terminologies

• The variables xj are called decision variables.


• The linear function z to be optimised is called objective function or cost function.
• The inequalities and equations are called constraints.

Canonical form of a LP
Pn
Max z = j=1 cj xj

Pn
s.t. j=1 aij xj ≤ bi, i = 1, . . . , m;

xj ≥ 0, j = 1, . . . , n.

• Maximisation type problem;


• All the constraints are in the form “≤”;
• All the decision variables are non negative.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-11/44
Standard form of a LP
Pn
Max z = j=1 cj xj

Pn
s.t. j=1 aij xj = bi, i = 1, . . . , m;

xj ≥ 0, j = 1, . . . , n.

• Maximisation type problem;


• All the constraints are equations;
• All the decision variables are non negative.

From canonical to standard form

The standard form of a LP can be obtained from the canonical one by adding a positive
slack variable xn+i to the left hand side term of each constraint i:
Xn Xn
aij xj ≤ bi −→ aij xj + xn+i = bi.
j=1 j=1

Therefore, we get the following:


QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-12/44
Pn Pm
Max z = j=1 cj xj + i=1 0 × xn+i
Pn
s.t. j=1 aij xj + xn+i = bi, i = 1, . . . , m;

xj ≥ 0, j = 1, . . . , n + m.

Matricial notation of the canonical form of a LP

Max z = cx

s.t. Ax ≤ b,

x ≥ 0n ,
     
a11 · · · a1n x1 b1
with A =  .. . . . ..  , x =  ..  , b =  ..  with c = c1 · · · cn  .
am1 · · · amn xn bm

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-13/44
Transformation rules

• Minimisation ←→ Maximisation: [Min z = cx] ⇐⇒ [Max z ′ = −cx].

• Inequation “ ≥′′ ←→ “ ≤′′: ax ≥ b ⇐⇒ (−a)x ≤ −b.


 
ax ≤ b ax ≤ b;
• Equation ←→ “ ≤′′: ax = b ⇐⇒ ⇐⇒
ax ≥ b (−a)x ≤ −b.
ax ≤ b ⇐⇒ ax + s = b, s ≥ 0;
• Inequation ←→ equation:
ax ≥ b ⇐⇒ ax − s = b, s ≥ 0.
x = x′ − x′′;

• Real variable ←→ non negative variable: x ∈ R ←→
x′, x′′ ≥ 0.
x = x′ + b;

• Lower bounded variable: x ≥ b ←→
x′ ≥ 0.

x ≤ b;
• Absolute value: |x| ≤ b ⇐⇒
x ≥ (−b).

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-14/44
Some definitions and terminologies in Linear Programming
Algebraical considerations

Definition 2.

Solution: Any n-uplet (x1, x2, . . . , xn) which satisfies the following constraints of a LP
X n
aij xj = bi, i = 1, 2, . . . , m
j=1

is said to be a solution of this LP.


Feasible solution: If a solution of a LP satisfies
xj ≥ 0, j = 1, . . . , n,
then it is called a feasible solution of this LP.

Definition 3.

Basis: A basis is any set of m variables chosen from x1, x2, . . . , xn such that the determinant of
the corresponding coefficients aij is non null. In other words the column vectors in the matrix A,
associated to the m variables form a basis of Rm.
QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-15/44
Definition 4.

Basic solution: A basic solution is any solution which consists of n − m variables equal to zero and
such that the other m variables form a basis of Rm. In a basic solution, the variables which are
set equal to zero are referred to as non-basic variables and the other variables, forming the basis, are
called basic variables.

Basic feasible solution: A basic solution which is feasible is called a basic feasible solution.

Optimal solution: Any feasible solution which optimises (i.e., maximises or minimises) the objective
function
X n
z= c j xj
j=1
is called an optimal solution.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-16/44
Geometrical considerations

Definition 5. The set of feasible solutions of a linear programming problem is called the feasible
region of this problem.

Definition 6. A non empty set is a convex set if for any couple of points k1, k2 of this set and for
any λ ∈ (0, 1), we have λk1 + (1 − λ)k2 is also a point of this set.

Theorem 1. In the space of decision variables, the feasible region of a LP is a convex set which is

• either an empty set;


• either an unbounded convex polyhedron;
• or a convex polyhedron, also referred to as a polytope.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-17/44
Proposition 1. Any basic feasible solution of a LP corresponds to an extreme point of the feasible
region of this LP.

Theorem 2. If a LP has at least one finite optimal solution, then there exists at least an optimal
solution which is an extreme point of its feasible region.

Example 2. Consider the following systems of constraints in a two dimensional space:

 

 x1 + x2 ≤ 5 
x1 + x2 ≥ 3

 2x + x ≤ 8 
1 2 −3x1 + 2x2
 ≤ 6
(S1) = (S2) =

 x1 ≥ 0 
 x1 ≥ 0
x2 ≥ 0 ≥ 0
 
  x2

The region described by the systems (S1) and (S2) are given by the closed polyhedrons
colored in gray in the following figures.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-18/44
x2 x2

8 8

6
=
2
2x
2x 1

+
+x

x1
−3
2
=8
x1
+
x2

4 4
=
5

x1
+
x2
=
3
0 2 4 6 x1 0 2 4 6 8 x1

The system (S1) describes a bounded polyhedron, i.e a polytope. The system (S2) describes an unbounded polyhedron.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-19/44
Solving a Linear Programming problem
There exist various methods which can be used to solve a LP. The most classical of them
are:

• Graphical method: This method is usable only if the problem consists of two (or three)
variables.

• Counting basic solutions’ method: This method is not suitable for practical problem since
it is too long to implement!

• Simplex method: This method enables to check if a LP has at least one feasible solution
and if yes, it provides an optimal solution of the LP after a finite number of iteration.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-20/44
Results of a linear optimisation

One of the following cases occurs when a LP is solved:

1. The LP has a unique optimal solution.

2. The LP has an infinite number of optimal solutions.

3. The LP is infeasible i.e. it has no feasible solutions (the feasible region is an empty set).

4. The LP is unbounded, i.e., in the feasible region there are points with arbitrarily large
(in the case of maximisation type problem) values of the objective function.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-21/44
Graphical resolution
Example 3. Consider the following LP:
x2

14

z=
Max z= x1 + 3x2 x1 +
3x2
= 30
s.t. x1 + x2 ≤ 14
−2x1 + 3x2 ≤ 12 8 b

2x1 − x2 ≤ 12
x1 , x2 ≥ 0 z=
x
b

1 + 3x
=2 4

x1
b
2
Dire

+
ction Feasible region

x2
in w
hich

=
z inc

14
In this case, the feasible region is a convex polytope. In reas es
this region, we are looking for a point (or some points) −6
b

0
b

6 14 x1
12
that the coordinates maximise z. All the straight lines 3x 2
=
+
of equation x1 + 3x2 = constant are parallel and two −2
x 1

2
=1
of them are plotted when the constant is equal to 2

2
+x
and 30, respectively. The optimal solution for this LP

1
2x
is unique and corresponds to the extreme point of the
feasible region with coordinates (6, 8) for which z = 30.
Therefore, x1 = 6, x2 = 8 and z = 30.
−12

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-22/44
Example 4. Consider the following LP:
x2
Min z = x2 − x1
s.t. 2x1 − x2 ≥ −2

2
=−

s
=

= ease
x1 − x2 ≤ 2

1
x

cr
2 −

1
2

de
−x
+ ≤ 5


x1 x2

z
=

= hich

1
1
x1 , x2 ≥ 0

x
z
2x

2 −
w
in

x
n
4

io
b

z
ct
re
In this example, the feasible region is also a con-

Di
vex polytope. In this region, we are looking for a
2 b

point (or some points) that the coordinates min- b


B
Feasible region
imise z. All the the straight lines of equation
x2 − x1 = constant are parallel. Therefore the

x1
b b

2A

+
straight lines representing the objective function 0 4 x1

x2
=
and the constraint x1 − x2 = 2 are parallel. The

5
optimal solutions for this LP are: the extreme
points A(2, 0) and B(3.5, 1.5) and all the points

2
=
on the segment (A, B). Hence we have an infinite

x2

number of optimal solutions. The corresponding

x1
value of z for all these solutions is z = −2.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-23/44
Example 5. Consider the following LP:
x2

Max z = 5x1 + 7x2

x1

x1 = 4
+
s.t. x1 + x2 ≥ 6

x2
z= Di

=
5x rec

6
x1 ≥ 4 1 + ti on
7x in
x2 ≤ 3 6 2 = wh
50 i ch
x1 , x2 ≥ 0 zi
nc
rea
4 ses
x2 = 3 b

In this example, the feasible region is an unbounded


2 b
Feasible region
convex polyhedron. The value of the objective func-
tion z = 3x1 + 7x2 keeps growing indefinitely in the
feasible region. The optimal value of z is “obtained” at b

0 2 4 6 x1
the points (x1 = +∞, x2 ≤ 3), therefore z is infinite.
z=
5x
1 +
7x
2 =
21

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-24/44
Example 6. Consider the following LP:
x2

Min z = x2 − x1

2
s.t. 2x1 − x2 ≥ −2

=−
x1 − 2x2 ≤ −8

2
−x
x1 + x2 ≤ 5 8
=−

1
2x
2x 2
x1 , x2 ≥ 0 x1

6

In this example, the feasible region is an empty set! This


means that the problem is infeasible. One can check that 4

algebraically, by summing the three constraints term by


term:

x1
2

+
x2
=
−2x1 + x2 ≤ 2

5
x1 − 2x2 ≤ −8 0 2 4 6 x1
x1 + x2 ≤ 5
0 ≤ −1
This is absurd!

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-25/44
The Simplex method

Principle of the Simplex method

When the feasible region is a convex polyhedron, the optimal solutions occurs at extreme
points of this polyhedron. Therefore one may try to find an optimal solution in the set of
extreme points of the feasible region. In other words, since there exists a one to one cor-
respondance between extreme points (of the feasible region) and basic feasible solutions,
one may look for the optimal solution in the set of basic feasible solutions.

The principle of the Simplex method is as follows:

1. Find a first basic feasible solution;


2. Move from one basic feasible solution to another such that the value of the objective
function is improved at each step.
3. Stop when it is not possible to improve the value of the objective function. The last
basic feasible solution is the optimal solution.

Remark 2. When the feasible region is an unbounded convex polyhedron, the Simplex method
enables to know whether the optimal solution is finite or not.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-26/44
The Simplex method

Linear programming problems can be solved using algorithms such the Simplex Method
or the Interior Point Method. In R, methods for solving linear optimization problems can
be found in the package lpSolveAPI.

If the lpSolveAPI is not available in R, it can be installed as follows:

install.packages("lpSolveAPI")

Since most of optimization methods available in R, including lpSolveAPI, are im-


plemented for minimisation type problems, and the solution which maximises a function
f (x) minimises the function −f (x), then we need to multiply the objective functions
for maximisation type Linear Programming problems by −1, and solve the corresponding
minimisation problems. Afterwards, we multiply the values of the objective functions by
−1 to recover the value of the objective functions of the initial problem.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-27/44
Example 7. Let us consider the following Linear Programming problems:

Maximize f (x1, x2) = x1 + 3x2 Minimize f (x1, x2) = x2 − x1


subject to x1 + x2 ≤ 14 subject to 2x1 − x2 ≥ −2
(P1) −2x1 + 3x2 ≤ 12 (P2) x1 − x2 ≤ 2
2x1 − x2 ≤ 12 x1 + x2 ≤ 5
x1 , x2 ≥ 0 x1 , x2 ≥ 0

Maximize f (x1, x2) = 5x1 + 7x2 Minimize f (x1, x2) = x2 − x1


subject to x1 + x2 ≥ 6 subject to 2x1 − x2 ≥ −2
(P3) x1 ≥ 4 (P4) x1 − 2x2 ≤ −8
x2 ≤ 3 x1 + x2 ≤ 5
x1 , x2 ≥ 0 x1 , x2 ≥ 0

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-28/44
The problem (P1) can be solved using the lpSolveAPI package as follows:

#The package lpSolveAPI is required here


library(lpSolveAPI)
#Building the model
P1 <- make.lp(0, 2) #Setting the number of variables
set.objfn(P1, c(-1, -3)) #Setting the objective-function -f
add.constraint(P1, c(1, 1), "<=", 14) # Adding the constraints
add.constraint(P1, c(-2, 3), "<=", 12)
add.constraint(P1, c(2, -1), "<=", 12)
#visualising the model
P1
Model name:
C1 C2
Minimize -1 -3
R1 1 1 <= 14
R2 -2 3 <= 12
R3 2 -1 <= 12
Kind Std Std
Type Real Real
Upper Inf Inf
Lower 0 0
#Solving the model
solve(P1)
[1] 0 #This indicates that the problem has a finite optimal
solution
get.variables(P1)
[1] 6 8 #These are the obtained optimal values of x1 and x2,
respectively
get.objective(P1)
[1] -30 #This is the obtained optimal value of -f, thus f=30

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-29/44
The problem (P2) is solved using the lpSolveAPI package as follows:

#The package lpSolveAPI is required here


library(lpSolveAPI)
#Building the model
P2 <- make.lp(0, 2)
set.objfn(P2, c(-1, 1))
add.constraint(P2, c(2, -1), ">=", -2)
add.constraint(P2, c(1, -1), "<=", 2)
add.constraint(P2, c(1, 1), "<=", 5)
#Solving the model
solve(P2)
[1] 0 #This indicates that the problem has a finite optimal
solution
get.variables(P2)
[1] 2 0 #These are the obtained optimal values of x1 and x2,
respectively
get.objective(P2)
[1] -2 #This is the obtained optimal value of f

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-30/44
The problem (P3) can be solved using the lpSolveAPI package as follows:

#The package lpSolveAPI is required here


library(lpSolveAPI)
#Building the model P3
P3 <- make.lp(0, 2)
set.objfn(P3, c(-5, -7))
add.constraint(P3, c(1, 1), ">=", 6)
#The second constraint is just a lower bound on x2
set.bounds(P3, lower = 4, columns = 1)
#The third constraint is just an upper bound on x1
set.bounds(P3, upper = 3, columns = 2)
#Solving the model
solve(P3)
[1] 3 #This indicates that the problem is unbounded i.e the
optimal solution of P3 is not finite

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-31/44
The problem (P4) can be solved using the lpSolveAPI package as follows:

#The package lpSolveAPI is required here


library(lpSolveAPI)
#Building the model
P4 <- make.lp(0, 2)
set.objfn(P4, c(-1, 1))
add.constraint(P4, c(2, -1), ">=", -2)
add.constraint(P4, c(1, -2), "<=", -8)
add.constraint(P4, c(1, 1), "<=", 5)
#Solving the model
solve(P4)
[1] 2 # This indicates that the problem is infeasible i.e there
are contradicting constraints in the problem

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-32/44
Now suppose that in the problem (P1) x1 is a binary variable (i.e. it takes only the value
0 or 1), and x2 is an integer variable, then we need to set them to the appropriate type
before solving the problem (P 1). This can be done as follows:

set.type(P1, 1, "binary")
set.type(P1, 2, "integer")
solve(P1)
[1] 0 #This indicates that the problem has a finite optimal
solution
get.variables(P1)
[1] 1 4 #These are the obtained optimal values of x1 and x2,
respectively
get.objective(P1)
[1] -13 #This is the obtained optimal value of -f, thus f=13

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-33/44
Particular LP problems: Transportation problems
Example 8. A national power company has three power plants which supply the needs
of four major cities of the country. Each power plant can supply the following number of
Kwh of electricity:
Plant 1 Plant 2 Plant 3
35 million 50 million 40 million

The peak power demands (in Kwh) in these four cities are following:
City 1 City 2 City 3 City 4
45 million 20 million 30 million 30 million

The costs of sending 1 million Kwh of electricity from a given plant to a given city are
summarized in the table below.

❍❍
To
❍❍
❍❍ City 1 City 2 City 3 City 4
From ❍❍

Plant 1 £8 £6 £10 £9
Plant 2 £9 £12 £13 £7
Plant 3 £14 £9 £16 £5

What could be the shipping plan for this company in order to supply all the four cities in
electricity from its plants at a minimum cost?

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-34/44
Modelling a transportation problem

In general a transportation problem is specified by the following informations:

• A set of m supply points from which goods are shipped. A supply point i can supply
at most si units of goods.
• A set of n demand points where goods are shipped. A demand point j must receive
at least dj units of goods.
• Each unit of goods shipped from supply point i to demand point j incurs a cost cij .

Let us denote by xij the quantity of goods to be shipped from supply point i to demand
point j. Then, the relevant data can be summarised in the following tableau (also referred
to as the transportation tableau):

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-35/44
❤❤❤
❤❤❤❤
❤❤❤
❤❤❤❤ Demand points
❤❤❤❤
❤❤❤ Demand Demand . . . Demand . . . Demand Supply
Supply points ❤❤❤❤
❤❤❤❤

point 1 point 2 point j point n
❍❍ ❍❍ ❍❍ ❍❍ ❍❍ ❍❍
❍❍ c11 ❍❍❍ c12 ❍❍❍ . . . ❍❍❍ c1j ❍❍❍ . . . ❍❍❍ c1n
Supply point 1 ❍❍ ❍ ❍ ❍ ❍ ❍ s1
x11 ❍❍❍❍ x12 ❍❍❍❍ . . . ❍❍❍❍ x1j ❍❍❍❍ . . . ❍❍❍❍ x1n ❍❍❍❍
❍❍ ❍ ❍ ❍ ❍ ❍
❍❍ c21 ❍❍❍❍ c22 ❍❍❍❍ . . . ❍❍❍❍ c2j ❍❍❍❍ . . . ❍❍❍❍ c2n
Supply point 2 ❍❍ ❍ ❍ ❍ ❍ ❍ s2
x21 ❍❍❍❍ x22 ❍❍❍❍ . . . ❍❍❍❍ x2j ❍❍❍❍ . . . ❍❍❍❍ x2n ❍❍❍❍

❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ ...
.. ❍❍ ❍ ❍ ❍ ❍ ❍ ..
... ❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍
❍ ❍ ❍ ❍ ❍ ❍
❍❍ ❍❍ ❍❍ ❍❍ ❍❍ ❍❍
❍❍ c i1 ❍❍ c i2 ❍❍ . . . ❍❍ c ij ❍❍ . . . ❍❍ c in
Supply point i ❍❍ ❍❍ ❍❍ ❍❍ ❍❍ ❍❍
si
xi1 ❍❍❍❍ xi2 ❍❍❍❍ . . . ❍❍❍❍ xij ❍❍
❍❍ . . . ❍❍
❍❍ x in
❍❍
❍❍

❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ . . . ❍❍❍❍ ...
.. ❍❍ ❍ ❍ ❍ ❍ ❍ ..
... ❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍ . . .
❍❍
❍❍
❍ ❍ ❍ ❍ ❍ ❍
❍❍ ❍❍ ❍❍ ❍❍ ❍❍ ❍❍
❍❍ c m1 ❍❍ c m2 ❍❍ . . . ❍❍ c mj ❍❍ . . . ❍❍ c mn
Supply point m ❍❍ ❍❍ ❍❍ ❍❍ ❍❍ ❍❍
sm
xm1 ❍❍❍❍ xm2 ❍❍❍❍ . . . ❍❍❍❍ xmj ❍❍❍❍ . . . ❍❍❍❍ xmn ❍❍❍❍
Demand d1 d2 ... dj ... dn

Problem. Find the quantity of goods xij ( i = 1, 2, . . . , m; j = 1, 2, . . . , n) to be shipped from


the supply point si to the demand point dj in order to satisfy the demands at all the demand points
and such that the shipment cost is minimal.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-36/44
Formulation of a transportation problem

Let xij ( i = 1, 2, . . . , m; j = 1, 2, . . . , n) be the quantity of goods to be shipped from


the supply point si to the demand point dj .
m X
X n
Objective: Minimise the total shipment cost z = cij xij .
i=1 j=1

Constraints:

• The total supply at each supply point i (i = 1, 2, . . . , m) is si, therefore we must have
Xn
xij ≤ si, i = 1, 2, . . . , m;
j=1

• The total demand at each demand point j (j = 1, 2, . . . , n) is dj , therefore we must


have m
X
xij ≥ dj , j = 1, 2, . . . , n;
i=1
• The quantity of good xij should be non negative, therefore: xij ≥ 0, ∀i, j.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-37/44
The mathematical model:

Pm Pn
Minimise z = i=1 j=1 cij xij

Pn
subject to j=1 xij ≤ si, i = 1, 2, . . . , m
(1)
Pm
i=1 xij ≥ dj , j = 1, 2, . . . , n

xij ≥ 0, ∀i, j

One can notice that a transportation problem is a linear programming problem (with too
many variables!), however there exists a variant of the Simplex method which can be used
to solve this class of LP more quickly than with the classical Simplex method.

Remark 3. It may happen that a transportation problem is a maximisation type problem. How-
ever it remains a transportation problem as long as the constraints are similar to those in (1).

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-38/44
Remark 4. When the total supply equals the total demand, i.e.
Xm Xn
si = dj ,
i=1 j=1

then the transportation problem is said to be a balanced transportation problem. In this case the
mathematical model can be written

Pm Pn
Minimise z = i=1 j=1 cij xij

Pn
subject to j=1 xij = si, i = 1, 2, . . . , m; (2)
Pm
i=1 xij = dj , j = 1, 2, . . . , n.

The transportation problem in Example 8 is a balanced transportation problem. The


formulation and the corresponding mathematical model for this problem are as follows:

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-39/44
❤❤❤
❤❤❤❤
❤❤❤
❤❤❤❤ Demand points
❤❤❤
❤❤❤❤ City 1 City 2 City 3 City 4 Supply
Supply points ❤❤❤
❤❤❤❤
❤❤
❍ ❍ ❍ ❍

❍❍

8
❍❍

❍❍ 6 ❍
❍❍ 10 9
Plant 1 ❍❍ ❍❍ ❍❍ ❍❍
35
x 11
❍❍
❍❍ 12 x❍❍
❍❍ 13
❍❍
❍❍ x 14
❍❍
❍❍ x
❍❍ ❍❍ ❍❍ ❍❍
❍❍ 9
❍❍ ❍❍ 12 ❍❍ 13 7
Plant 2 ❍❍ ❍❍ ❍❍ ❍❍
50
x 21

❍❍
❍ 22 x❍
❍❍
❍ 23

❍❍

x 24

❍❍

x
❍ ❍ ❍ ❍
❍❍
14
❍❍ ❍❍
9 ❍❍
16 5
Plant 3 ❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍ 40
x 31 ❍❍
❍ 32 x ❍❍
❍ 33 ❍❍

x 34 ❍❍

x
Demand 45 20 30 30 125




 Min z = 8x11 + 6x12 + 10x13 + 9x14 + 9x21 + 12x22+

13x23 + 7x24 + 14x31 + 9x32 + 16x33 + 5x34








 s. t.
x11 + x12 + x13 + x14 ≤ 35





x21 + x22 + x23 + x24 ≤ 50



x31 + x32 + x33 + x34 ≤ 40

x11 + x21 + x31 ≥ 45








 x12 + x22 + x32 ≥ 20




 x13 + x23 + x33 ≥ 30
x14 + x24 + x34 ≥ 30





xij ≥ 0, i = 1, 2, 3; j = 1, 2, 3, 4.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-40/44
Balancing an unbalanced transportation problem

Case of supply excess

When the total supply exceeds the total demand in a transportation problem, i.e.
Xm Xn
si ≥ dj ,
i=1 j=1

one can balance this problem by creating a dummy demand point whose demand is equal to
the amount of supply excess. Since the shipments at the dummy point are just “virtual”
shipments, they are assigned a zero cost.

Example 9.
Suppose that in Example 8, the electricity demand of City 1 is now 40 million Kwh. Then
the corresponding problem is an unbalanced transportation problem with supply excess.
Indeed, the total demand is now 120 million Kwh whereas the supply is 125 million Kwh.
In order to balance the problem, we add a dummy point whose demand is 5 million Kwh
(i.e. 125 − 120).
The cost of shipping 1 million Kwh from each plants to the dummy point is £0.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-41/44
Then the formulation of the corresponding balanced transportation problem is as follows.
❤❤❤❤
❤❤❤
❤❤❤❤ Demand points
❤❤❤
❤❤❤❤
❤❤❤ City 1 City 2 City 3 City 4 Dummy Supply
Supply points ❤❤❤❤
❤❤❤❤

❍❍ ❍❍ ❍❍ ❍❍ ❍❍
❍ 8
❍ ❍ 6 ❍ 10
❍ 9 0
Plant 1 ❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍ 35
x 11 ❍❍
❍ 12 x ❍❍
❍ 13 ❍❍

x 14 ❍❍
❍ 15 x ❍❍

x
❍ ❍ ❍ ❍ ❍
❍❍
9
❍❍ ❍❍
12 ❍❍
13
❍❍
7 0
Plant 2 ❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍ 50
x 21 ❍❍
❍ 22 x ❍❍
❍ 23 ❍❍

x 24 ❍❍
❍ 25 x ❍❍

x
❍❍ ❍❍ ❍❍ ❍❍ ❍❍
❍❍ 14
❍❍ ❍❍ 9 ❍❍ 16
❍❍ 5 0
Plant 3 ❍❍ ❍❍ ❍❍ ❍❍ ❍❍
40
x 31
❍❍
❍❍ 32 x❍❍
❍❍ 33
❍❍
❍❍ x 34
❍❍
❍❍ 35 x❍❍
❍❍ x
Demand 40 20 30 30 5 125

Case of unmet demand

When the total supply is less the total demand in a transportation problem, i.e.
Xm n
X
si ≤ dj ,
i=1 j=1

the problem has no feasible solution. However, in order to make the problem feasible,
one can introduce a dummy supply point (for the shortage) whose supply will satisfy the
unmet demand with penalty (i.e. a cost).

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-42/44
Example 10.
Suppose that in Example 8, the electricity demand of City 1 is now 50 million Kwh. Then
the corresponding problem is an unbalanced transportation problem with unmet demand,
since the total demand is now 130 million Kwh whereas the supply is 125 million Kwh.
Assume that for each million of Kwh of unmet demand, there is a penalty of £70 (for this
case, the penalty could be for example the cost of supplying each million of Kwh of the
unmet electricity demand from another company).
Then the formulation of the corresponding balanced transportation problem is as follows.
❤❤❤❤
❤❤❤
❤❤❤❤ Demand points
❤❤❤
❤❤❤❤
❤❤❤❤ City 1 City 2 City 3 City 4 Supply
Supply points ❤❤❤
❤❤❤❤

❍❍ ❍❍ ❍❍ ❍❍
❍❍ 8
❍❍ ❍❍ 6 ❍❍ 10 9
Plant 1 ❍
❍❍

❍❍

❍❍

❍❍ 35
x11 ❍❍
❍ 12 x❍❍
❍ 13 ❍❍

x14 ❍❍

x
❍ ❍ ❍ ❍
❍❍ ❍❍
9 ❍❍
12 ❍❍
13 7
Plant 2 ❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍ 50
x21 ❍❍
❍ 22 x❍❍
❍ 23 ❍❍

x24 ❍❍

x
❍❍ ❍❍ ❍❍ ❍❍
❍❍ 14
❍❍ ❍❍ 9 ❍❍ 16 5
Plant 3 ❍❍ ❍❍ ❍❍ ❍❍
40
x31
❍❍
❍❍ 32 x
❍❍
❍❍ 33
❍❍
❍❍ x34
❍❍
❍❍ x
❍ ❍ ❍ ❍
❍❍
70
❍❍ ❍❍
70 ❍❍
70 70
Dummy (Shortage) ❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍
❍❍ 5
x41 ❍❍
❍ 42 x❍❍
❍ 43 ❍❍

x44 ❍❍

x
Demand 50 20 30 30 130

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-43/44
Solving a transportation problem

To solve a transportation problem, we will consider the balanced form of the problem
(which is nothing but the standard form of a Linear Programming problem). Then a
variant of the Simplex method, called the Transportation-Simplex method, can be used to
solve the balanced problem. However, in this course, we will always use lpSolveAPI
package to solve any transportation problem, as in Example 7.

Solution of the problem in Example 7.


The optimal shipping plan for this company in as follows:


❍❍
To
❍❍
❍❍ City 1 City 2 City 3 City 4 Supply
From ❍
❍❍

Plant 1 − 10 million Kwh 25 million Kwh − 35


Plant 2 45 million Kwh − 5 million Kwh − 50
Plant 3 − 10 million Kwh − 30 million Kwh 40
Demand 45 20 30 30 125
Total cost: £1020

Total cost = 10 × 6 + 25 × 10 + 45 × 9 + 5 × 13 + 10 × 9 + 30 × 5 = 1020.

QUB SOR1021 - Introduction to Statistical and Operational Research Methods Chapter 1 Page-44/44

You might also like