MTH2205 LP
MTH2205 LP
LINEAR PROGRAMMING
LECTURE NOTES
22
TH
Dr. JULIET NAKAKAWA NSUMBA
-M
&
Dr. GEOFREY ISMAIL MIRUMBE
Department of Mathematics
Makerere University
C
MT
K-
MA
1
Makerere University MTH2205 - LINEAR PROGRAMMING
Course outline
05
1. The general linear programming (LP) problem: The algebra and geometry of LP
models.
22
constraint set and basic solutions.
3. The simplex method: The derivation of the conditions for the existence and optimality
of the solution. The initial basic solution;
4. Degeneracy and Cycling: The Big-M (penalty) method. The two phase simplex
method.
TH
5. The dual Problems: The Dual simplex algorithm, the process of duality. The mutual
primal-dual simplex algorithm.
6. Post optimality analysis: Investigation of how changes in the objective function and
the constraints of an LP problem would a↵ect the current optimal solution.
References -M
- Lecture notes on Mathematical programming by L.S. Luboobi.
05
1 Introduction and the general linear programming prob-
lem
Linear Programming is a sub-field of optimization theory, which is itself a sub-field of Applied
Mathematics. Applied Mathematics is a very general area of study that could arguably en-
22
compass half of the engineering disciplines if you feel like getting into an argument with an
engineer. Put simply, applied mathematics is all about applying mathematical techniques to
understand or do something practical.
Optimization is an exciting sub-discipline within applied mathematics. Optimization is all
about making things better; this could mean helping a company make better decisions to max-
imize profit; helping a factory make products with less environmental impact; or helping a
TH
zoologist improve the diet of an animal. When we talk about optimization, we often use terms
like better or improvement. It’s important to remember that words like better can mean
more of something (as in the case of profit) or less of something as in the case of waste. As we
study linear programming, we’ll quantify these terms in a mathematically precise way. For
the time being, let’s agree that when we optimize something we are trying to make some
decisions that will make it better. Other applications of optimization tool include;
• Game theory.
A mathematical optimisation problem has three major components: decision variables, objec-
tive function, and constraints.
C
i) Decision variables are physical quantities controlled by the decision maker and repre-
sented by mathematical symbols. For example, the decision variable xj can represent the
number of contact hours of course unit j that a student must attend in a semester.
MT
ii) Objective function defines the criterion for evaluating the solution. It is a mathematical
function of the decision variables that converts a solution into a numerical evaluation of
that solution. For example, the objective function may measure the profit or cost that
occurs as a function of the amounts of various products produced. The objective function
also specifies a direction of optimization, either to maximize or minimize.
iii) Constraints are a set of functional equalities or inequalities that represent physical,
economic, technological, legal, ethical, or other restrictions on what numerical values can
K-
be assigned to the decision variables. For example, constraints might ensure that no more
input is used than is available.
Definition 1.1. A Mathematical optimization problem is one in which some function is either
maximised or minimised relative to a given set of alternatives. The function to be either
minimised or maximised is called the objective f unction and the set of restrictions is called
the constraint set.
MA
05
1.1 Advantages of mathematical optimization models
The main benefit of optimization models is the ability to evaluate possible solutions in a quick,
safe, and inexpensive way without actually constructing and experimenting with them. Other
benefits are as follows.
22
1. Structures the thought process. Constructing an optimization model of a problem
forces a decision maker to think through the problem in a concise, organized fashion.
The decision maker determines what factors he or she controls; that is, what the deci-
sion variables are. The decision maker specifies how the solution will be evaluated (the
objective function). Finally, the decision maker describes the decision environment (the
constraints). Modelling acts as a way of organizing and clarifying the problem.
TH
2. Increases objectivity. Mathematical models are more objective since all assumptions
and criteria are clearly specified. Although models reflect the experiences and biases of
those who construct them, these biases can be identified by outside observers. By using
a model as a point of reference, the parties can focus their discussion and disagreements
on its assumptions and components. Once the model is agreed on, people tend to live by
the results.
-M
3. Makes complex problems more tractable. Many problems in managing an orga-
nization are large and complex and deal with subtle, but significant, interrelationships
among organizational units. For example, in determining the optimal amounts of various
products to ship from geographically dispersed warehouses to geographically dispersed
customers and the routes that should be taken, the human mind cannot make the billions
of simultaneous trade-o↵s that are necessary. In these cases, the decision maker often
uses simple rules of thumb, which can result in less than optimal solutions. Optimization
models make it easier to solve complex organization-wide problems.
C
4. Make problems amenable to mathematical and computer solution. By rep-
resenting a real problem as a mathematical model, we use mathematical solution and
analysis techniques and computers in a way that is not otherwise possible.
MT
1. The actual formulation or construction of the model is the most crucial step in mathemat-
ical modeling. Since the problems tend to be very complex, it is possible to mismodel the
MA
real problem. Important decision variables or relationships may be omitted or the model
may be inappropriate for the situation. The optimal solution to the wrong problem is of
no value
05
2. Not understanding the role of modeling in the decision-making process. The optimal
solution for a model is not necessarily the optimal solution for the real problem. Math-
ematical models are tools to help us make good decisions. However, they are not the
only factor that should go into the final decision. Sometimes the model only evaluates
solutions with regard to quantitative criteria. In these cases qualitative factors must also
22
be considered when making the final decision.
TH
form,
min/max z = c1 x1 + c2 x2 + . . . + cn xn
s.t the constraints(restrictions)
ai1 x1 + ai2 x2 + . . . + ain xn {<, =, >} bi
and x1 , x2 , . . . , xn 0 8 i = 1, 2, . . . , m.
-M
The general linear programming problem can also be re - written in the matrix form as,
min/max z = cx
s.t Ax {<, =, >} b
and x 0
or in Matrix form;0 1
K-
x1
minw = (2, 1, 7) @ x2 A subject to
0 1 0 x3 1 0 1
2 1 1 x1 7
@ 0 1 2 A @ x 2 A @ 1 A . 8 x 1 , x 2 , x3 0
1 0 30 x3 1 3 0 1
2 1 1 7
MA
05
1.5 Changing the sense of optimisation
P
n
A maximisation problem over the objective function z = cj xj is equivalent to a minimisation
j=1
problem with the same constraints but it’s objective function is
Pn
z= cj xj . The equivalence in this case imply that the solutions to the two problems are
22
j=1
the same in magnitude.
TH
j=1
n
X
aij xj bi .
j=1
where si 0 and
n
X
aij xj bi
MT
j=1
where ti 0
Here si &ti are referred to as slack and surplus variables respectively.
Maximise z = cx
s.t Ax b
and x 0
05
(ii) Minimisation canonical form that is of the form
Minimise w = cx
s.t Ax b
22
and x 0
Definition 1.2.
A linear programming problem is said to be in standard form if all its restrictions (constraint
set) are equalities.
Example 1.1. [Class Work] Write the following minimisation linear programming problems
TH
in canonical minimisation form, convert them to canonical maximisation linear programming
problems and hence or otherwise, transform them into standard form.
i).
Minimize Z = x1 + 4x2 x4
subject to: 2x1 + x2 + 2x3 2x4 4
-M x1 3x2 + x4 5
x1 + 2x2 + 3x3
x 1 , x2 , x3 , x4 0
3
ii).
Minimize Z = 2x1 3x2 + 4x3
subject to: 4x1 + 2x2 x3 4
3x1 + 2x2 + 3x3 6
C
x1 + x2 3x3 = 3
x 1 , x 2 , x3 0
MT
7x1 + 4x2 x3 25
x1 , x3 0, x2 unrestricted
0 00 0 00
Solution: Introducing slack and surplus variables and writing x2 = x2 x2 , where x2 0, x2
0, the problem in standard form is
0 00
MA
05
1.10 Examples on formulating Linear Programming Problems
Example 1.3. (Diet problem) A patient needs daily 5mg, 20mg and 15mg of vitamins A, B
and C respectively. The vitamins available from a mango are 0.5mg of A, 1mg of B, 1mg of
C, that from an orange is 2mg of B, 3mg of C and that from an apple is 0.5mg of A, 3mg of
B, 1mg of C. If the cost of a mango, an orange and an apple be Shs. 1000,Shs. 500 and Shs.
22
1500 respectively, find the minimum cost of buying the fruits so that the daily requirement of
the patient be met. Formulate the problem mathematically.
Solution: The problem is to find the minimum cost of buying the fruits. Let z be the
objective function. Let the number of mangoes, oranges and apples to be bought so that
the cost is minimum and to get the minimum daily requirement of the vitamins be x1 , x2 , x3
respectively. Then the objective function is given by
TH
z = 1000x1 + 500x2 + 1500x3
Example 1.4. An electronic company manufactures two radio models each on a separate
production line. The daily capacity of the first line is 60 radios and that of the second line
is 75 radios. Each unit of the first model uses 10 pieces of a certain electronic component,
whereas each unit of the second model uses 8 pieces of the same component. The maximum
daily availability of the special component is 800 pieces. The profit per unit of models 1 and
2 are Shs. 5000 and Shs. 4000 respectively. Determine the optimal daily production of each
model.
Solution: This is a maximization problem. Let x1 , x2 be the number of two radio models
each on a separate production line. Therefore the objective function is z = 5000x1 + 4000x2
K-
which is to be maximized. From the conditions of the problem we have x1 60, x2 75, 10x1 +
8x2 800. Hence the problem is
MA
05
Maximize z = 5000x1 + 4000x2
subject to: x1 60
x2 75
22
10x1 + 8x2 800
and
x 1 , x2 0
Exercise 1.1.
TH
1. (Transportation problem) Three di↵erent types of vehicles A, B and C have been used
to transport 60 tons of solid and 35 tons of liquid substance. Type A vehicle can carry 7
tons solid and 3 tons liquid whereas B and C can carry 6 tons solid and 2 tons liquid and
3 tons solid and 4 tons liquid respectively. The cost of transporting are shs. 500, shs. 400
and shs. 450 respectively per vehicle of type A, B and C respectively. Find the minimum
cost of transportation. Formulate the problem mathematically.
-M
2. An agricultural firm has 180 tons of Nitrogen fertilizers, 50 tons of Phosphate and 220
tons of Potash. It will be able to sell [Link] mixtures of these substances at a profit of Shs.
150 per ton and [Link] mixtures at a profit of Shs. 120 per ton respectively. Formulate a
linear programming problem to determine how many tons of these two mixtures should
be prepares so as to maximize profit.
used so as to minimise the cost for the meal yet satisfy the requirements of the nutritionist.
4. A manufacturer has three machines A, B and C with which he produces two di↵erent
products x and y, The di↵erent machining times required per product are as follows:
The estimated profits per product are 7, 500 U GX and 13, 500 U GX for x and y
K-
respectively. the amounts of time each machine is available for making the products
during any given week are restricted as follows:
Machine A is available for atmost 21 hours,
Machine B is available for atmost 40 hours,
Machine C is available for atmost 30 hours,
The Manufacturer’s objective is to make as much profit as he can, Formulate the problem
MA
5. A pharmaceutical firm produces two products H and M . Each unit of product H requires
3 hours of operation I and 4 hours of operation II, while each unit of product M requires
05
4 hours of operation I and 5 hours of operation II. Time available for operation I and
II are 20 hours and 26 hours respectively. Product H sells at a profit of 1, 000 U GX
per unit, while M sells at a profit of 2, 000 U GX. Determine the quantities of H and
M to be produced, so that the profit earned is maximum.
6. A farmer has 300 acres on which he can plant any combination of two crops, beans and
22
peas. Bean require 5 work-days and $15 of capital for each of the acre planted, while
peas require 2 worker-days and $20 of the capital for each acre planted. Suppose that
beans yields $40 per acre and peas $30 per acre. The farmer has $4000 of capital and 750
worker-day of labor for the year. Determine the most profitable planting strategy.
7. The Padania tile company manufactures three types of tiles: plain, awkward and fancy,
TH
in two di↵erent factories. The factory in Milan produces 3000 plain, 3000 awkward and
1000 fancy tiles a day and costs $2000 per day to operate. The factory in Turin produces
3000 plain, 1000 awkward and 2000 fancy tiles a day and costs $3000 a day to operate.
What is the most cost e↵ective way to produce atleast 21,000 plain, 9000 awkward and
10,000 fancy tiles.
8. A farmer would like to utilize his piece of land of 500 square metres to grow maize (M ),
-M
beans (B) and ground nuts (G). He has decided that wherever he is to plant beans or
ground nuts he will also plant some maize. However he will not mix the beans and the
groundnut. Also he may have maize planted separate from the beans and the ground
nuts. The time needed to look after each crop until after harvest and the expected profit
in dollars are given in the table below
According to the demands for these crops at least 50 square metres of land should be
planted by each of the crops in the table. The ratio of the area used for G. nuts to that
used for beans should not be less than 2 : 3. If the total time to be spent on the crops
during any season should not exceed 300 hours, formulate the problem of how the farmer
should partition his land for the crops such that his total profit is maximized. If all the
land has to be utilized for these crops reduce the number of variables in the problem to
two, so that the problem can be solved graphically (Do not solve it).
9. From two mines 1 and 2, Iron ore is to be transported to three di↵erent steel plants. The
K-
cost of transporting one ton of Iron ore to a plant is as in the table below. Formulate a
linear model to minimize the cost of transportation.
10. An advertising company is planning to advertise using three di↵erent media; television,
radio and magazines. It is expected that certain numbers of women will be reached on
05
average using each di↵erent media, and it is also known approximately what proportion
of the general population will be reached by each unit of advertising. The cost per unit
of advertising in each of the media as well as the expected number of women reached for
each unit of each type of advertising are given in the following table:
22
Advertising cost/shs Potential No of customers Women reached
Television 50,000 900,000 400,000
Radio 20,000 500,000 200,000
Magazine 10,000 200,000 150,000
The company only has shs 800, 000 available in its advertising budget and want to make
TH
sure that:
-M
units and no more than ten on radio.
Set up a linear programming model to achieve these goals with minimal costs.
C
MT
K-
MA
05
2 Graphical Solutions to Linear Programming Problems
2.1 Basic Terminology
Definition 2.1. A feasible solution to a linear program is a solution that satisfies all constraints.
22
Definition 2.2. The feasible region is the set of solutions to a finite number of linear inequal-
ities (constraints) and/or equality constraints.
Definition 2.3. A linear program (LP) is feasible if there exists a feasible solution. i.e if x
satisfies Ax = b, x 0,.
Definition 2.4. An optimal solution to a linear program is feasible solution that produces the
TH
best objective function value. A linear program may have multiple optimal solutions, but only
one optimal solution value.
Definition 2.5. A linear program is unbounded if the optimal solution is unbounded, i.e. it
is either 1 or 1. Note that the feasible region may be unbounded, but this is not the same
as the linear program being unbounded.
2.2 -M
Graphical solution of a linear programming problems:
Given any two dimensional linear programming problem, we can find the optimal solution to
the problem by the use of the following procedure.
- Plot the objective function on the graph starting with a value of z(w) = 0 and shift the
C
objective function in order to identify a point that either maximises or minimises the LP
objective.
MT
Note 2.1.
K-
(i) When solving linear programming problems the search for an optimal solution is restricted
to extreme points.
(ii) An unbounded solution set may give an unbounded optimal value (i.e optimal value may
not exist) or a finite optimal value may exist depending on the objective function of the
MA
LP problem.
(iii) Some LP’s may have more than one finite optimal values.
05
Example 2.2.
22
x 1 , x2 0
Example 2.3.
TH
maximise z = 2x1 + 5x2
s.t 2x1 + 3x2 12
3x1 + 4x2 12
x 1 , x2 0
Example 2.4.
-M
maximise z = 2x1 + 3x2
s.t x1 + 3x2 9
2x1 + 3x2 12
x 1 , x2 0
C
Solution
MT
Both (6, 0) and (3, 2) are optimal solutions then a line segment
= (3 + 3µ, 2 2µ)
for 0 µ 1. and on this line segment z = 2x1 + 3x2 = 12. that’s any point on the line
segment is an optimal value.
Exercise 2.1. Using graphical method find the optimal solution to the following linear pro-
K-
gramming problems.
(i)
min Z = 3x + 5y
s.t 2x + 3y 12
MA
x+y 3
x 4
y 3
05
(ii)
max w = 3x + 4y
s.t x y 0
x+y 1
22
x + 3y 3
x, y 0
(iii)
TH
maximise z = 2x1 x2
s.t x 1 + x2 2
x1 + x2 4
x 1 , x2 0
-M
(iv) On a piece of paper (Graph paper), Clearly show the region of the following constraint
set.
x1 + x2 1
x1 x2 1
3x1 + 2x2 6
x1 2x2 1
C
x 1 , x2 0
05
3 Mathematical Background to the simplex method
Definition 3.1.
The set H = {x 2 Rn : cx = k} where c is a non zero vector in Rn and k 2 R is a
constant is called The hyper plane in Rn .
22
Example 3.1.
In R2 A hyper plane represents a line in two dimensions. In R3 A hyper plane
represents a plane in three dimensions.
TH
If H1 = {x 2 Rn : cx < k or cx > k} then H1 is called a open half space(s) of the hyper-
plane.
Definition 3.3.
P
r
Let x1 , x2 , . . . , xr be points in Rn and µ1 , µ2 , . . . , µr a set of scalars, then µj xj is called a
j=1
convex linear combination or a convex combination of x1 , x2 , . . . , xr when µj 0 8 j and
Pr
j=1
µj = 1.
-M
In particular, The straight line with both ends at finite distances is called a line segment. Thus
the segment from a and b is defined by the expression {x : a + (1 )b, 0 1} where
a and b are points in R or (R ) in general.
2 n
Definition 3.4. point x is a boundary point of a set S of vectors if for every number ✏ >
0(however small), at least one point within the distance ✏ of x is in S, and at least one point
within the distance ✏ of x is outside S.
C
MT
K-
Definition 3.5.
A subset S of Rn is called a convex set if for any two distinct points x1 , x2 2 S, then the
line segement joining x1 and x2 lies in S, that is S is a convex linear combination of x1 and x2
if whenever x1 &x2 2 S then x = µx1 + (1 µ)x2 2 S for 0 µ 1.
Example 3.2.
Generally a set C is said to be convex if and only if given points x1 , x2 , . . . , xn 2 C then the
MA
P
n
point, x = 1 x1 + 2 x2 + . . . + n xn such that 0 i 1 and i = 1 is a point in C.
i=1
05
22
TH
3.1 Theorems about the Convex sets
Theorem 3.1.
Every Hyperplane H is a convex set.
By definition,
-M
Proof
x1 2 H ) cx1 = k
µ)x2 2 H with 0 µ 1.
x2 2 H ) cx2 = k
Thus, x 2 H ) {x 2 Rn such that cx = k}
cx = c(µx1 + (1 µ)x2 ) = µcx1 + cx2 + µcx2 .
= µk + k µk = k Hence x 2 H.
C
Theorem 3.2.
Let A be an m ⇥ n matrix and b be a vector in Rn , then the set of solutions to the linear system
MT
Proof
Let’s denote the set of all solutions to the linear system of equations as S. we show that if
x1 , x2 2 S then x = µx1 + (1 µ)x2 2 S with 0 µ 1,
By definition,
x1 2 S ! Ax1 = b
x2 2 S ! Ax2 = b
K-
Theorem 3.3. The solutions to the constraints of the LP problem form a convex set. (Proof
MA
is an exercise).
Theorem 3.4. The intersection of a finite collection of convex sets is convex. (Proof is an
exercise).
05
Definition 3.6.
A point U in a convex set S is called an extreme point of S if it’s not an interior point of
any line segment in S, that is U is an extreme point of a set S if there are no distinct points
x1 , x2 2 S such that U = µx1 + (1 µ)x2 for 0 < µ < 1.
Example 3.3.
22
The points A, B, C and D are extreme points in the following diagram ( two dimensional
diagram).
TH
Note 3.1. Extreme points of a convex set C are always boundary points but not vice versa.
Definition 3.7. The convex hull of a set P , denoted by P 0 , is the intersection of all convex
-M
sets Ci which contain P that’s P 0 = \i Ci such that Ci is convex and P ⇢ Ci .
The convex hull of a finite set of points is called the convex polytope spanned by these points.
Example 3.4. (in class) Note that a convex polytope is spanned by it’s extreme points i.e
any point in the polytope can be written as a linear combination of the extreme points.
Definition 3.9. A bounded convex set is one which can be enclosed in a rectangle in Rn
MT
Theorem 3.6. A closed bounded convex set in Rn is the convex hull of it’s extreme points.
Theorem 3.7. A closed and bounded convex set is a convex polytope i↵ it has finitely many
extreme points.
Definition 3.10. A polyhedron is algebraically defined as the set of solutions to the constraint
set of the linear programming problem or simply for a system of linear inequalities.
K-
Theorem 3.8. A convex polyhedron is the intersection of finitely many closed halfspaces.
Theorem 3.10. In a convex polytope, every point is a convex combination of extreme points.
Theorem 3.11. Suppose that the set(s) of all feasible solutions to a linear programming
problem is bounded, then one of the extreme points is an optimal solution.
MA
Proof: The proof will be laid out for a maximisation linear programming problem. Let
u1 , u2 , u3 , . . . , ur be the extreme points of S. Let zm = cum be the maximum of zi = cui for
05
i = 1, 2, . . . , r. Let x be any other feasible solution. Since the set of all feasible solutions is a
Pr
polyhedron then x = µi ui where µi 0 and
i=1
r
! r r r
X X X X
z=c µi u i = µi (cui ) = µi (zi ) µi (zm )
22
i=1 i=1 i=1 i=1
max z = cx
TH
s.t Ax = b
and x 0
standard LP problem
Note 3.3.
(i) Every m ⇥ m sub matrix B of A with |B| =
6 0 is a basis for the standard LP problem.
(ii) Every m linearly independent columns of A is a basis for the standard LP problem.
MA
n
(iii) There are atmost m
bases for the standard LP problem.
(iv) The assumption of rank m for the matrix A implies there is atleast one basis for the
standard LP problem.
5
Definition 3.12. B is a feasible basis for the standard LP problem if B is a basis and B 1 b 0.
Example 3.5.
20
maximise z = 120x1 + 100x2
s.t 2x1 + 2x2 8
5x1 + 3x2 15
x 1 , x2 0
H2
In standard form
MT
x 1 , x2 0
( In this case the interest here is to identify and create basic variables and the optimal value
be obtained) forexample we can make x1 and x2 basic variables and have, x1 34 x3 + 12 x4 = 32
and x2 + 54 x3 12 x4 = 52
✓ ◆
1 xB
(I : B R) = B 1 b or IxB = B 1 b B 1 RxR (1)
xR
.
.
MA
Equation (?)
05
Definition 3.13. The vector (xB (0), 0) 2 Rn is a basic solution of the standard LP problem
relative to the basis B.
Definition 3.14. The m components of xB (0) are called basic variables (or variables in the
solution), the n m components of xR are called non basic variables (or variables not in the
solution).
22
Definition 3.15. (xB (0), 0) is called a basic feasible solution of the standard LP problem if
(xB (0), 0) 0.
TH
Theorem 3.15. For the standard LP problem, every basic feasible solution is an extreme
point and conversely every extreme point is a basic feasible solution.
METHOD
empty).
-M
Note 3.5. If (1) is not possible then the problem has no solution ( solution space is
(2) Get another basis B1 such that cB xB (0) < cB1 xB1 (0) and if (2) is not possible then B
gives the required solution.
max z = cB xB + cR xR
MA
subject to,
05
1
Multiplying through equation (2) by B we get
xB + B 1 RxR = B 1 b (3)
which implies that xB = B 1 b B 1 RxR . using this result in the objective function we get,
z = cB [B 1 b B 1 RxR ] + cR xR .
22
= cB B 1 b cB B 1 RxR + cR xR .
= cB B 1 b + [cR cB B 1 R]xR
= z + [cR cB B 1 R]xR
TH
where z = cB B 1 b. and similarly xB = x B 1 RxR where x = B 1 b (basic solution)
Recall that xB = B 1 b B 1 RxR and let Y = B 1 R which is an m ⇥ (n m) matrix.
0 1
y11 . . . y1n m
B . ... . C
B C
Y =BB y i1 . . . y in m
C
C
@ . ... . A
n
X m
xi + yij xj = xi .
j=1
Let I be the indexing set of indices for the basic variables and J be the indexing set of indices
for the non basic (secondary) variables . The objective function and the set of constraints can
therefore be written respectively as,
X
z = z [zj cj ]xj (4)
j2J
X
xi = xi + yij xj (5)
K-
j2J
Suppose k 2 J that is xk is a non - basic variable, and we let it take on a positive value ✓ that
is ✓ > 0 but the rest of the non basic variables remain at a value zero then (4) becomes
z = z (zk ck )✓ (6)
The value of ✓ makes z smaller or larger depending on the sign and magnitude of (zk ck )✓.
MA
05
Sometimes the above condition on how z can be made larger is referred to as the criterion for
improvement of the solution or a criterion for identifying a variable that gives a better solution
that is in order to improve the value of the objective function we choose a non basic variable
((xk ) say) for which zk ck < 0 and give it a positive value of ✓. therefore min{zj cj } for
zj cj < 0 is regarded as the entry criterion for the simplex tableaux.
22
3.5 Sample of a simplex tableau
c1 c2 . . . cn
cBj xB x1 x2 . . . xn x
cB1 xB1 xB1
TH
cB2 xB2 xB2
. .
. B 1R I .
cBm xBm xBm
Zj cj z1 c1 z2 c2 zn cn z
Definition 3.17. A variable is said to be basic if it appears in only one of the constraint
equality and has a coefficient equal to 1.
Definition 3.18. A solution to the linear system of equations is said to be feasible if all of its
components are non - negative.
C
3.6 A typical example
For the LP problem,
MT
max Z = 2x + y
s.t x + 2y 5
3x y 1
x, y 0
Solution
K-
(i) Transform the Lp into standard form by introducing slack variables x1 and x2 into the
constraint set to get,
3x y + x2 = 1
x, y, x1 , x2 0
05
0 1
x
B y C
(ii) Write the problem in matrix form that is; minw = (2, 1, 0, 0) B C
@ x1 A subject to
x2
0 1
✓ ◆ x ✓ ◆
1 2 1 0 B y C B
C = 5 . 8 x 1 , x2 , x3 0
22
3 1 0 1 @ x1 A 1
✓ x2 ◆ ✓ ◆
1 2 1 0 5
Where A = ,b = , c = (2, 1, 0, 0).
3 1 0 1 1 ✓ ◆
1 2
From where we can decompose A and x into B, R, xB & xR with R = and
TH
✓ ◆ 3 1
1 0
B=
0 1
2 1 0 0
cBj x y x1 x2 x
0 x1 1 2 1 0 5
0 x2
Zj c j
3-M
2
-1
1
0
0
1
0
1
0
Suppose we have chosen xk (k 2 J) to become a basic variable, isolate the xk term from
equation(9)
X
xi = xi + yij xj + yik xk (10)
j2J {k}
Let xl be the basic variable to be exchanged with xk . Consider the lth constraint
X
xl = xl + ylj xk + ylk xk (11)
K-
j2J {k}
xl xl X ✓ ylj ◆
= + xj + xk .
ylk ylk ylk
j2J {k}
MA
xl
Note 3.6. The new value of x with the condition of non negativity implies that ylk
0 i↵
ylk > 0.
05
Eliminate xk from the two constraint equations (10) and (11) by multiplying equation (10) by
ylk and (11) by yik and subtract the two equations.
X
xi ylk = xi ylk + ylk yij xj + ylk yik xk
j2J {k}
22
X
xl yik = xl yik + yik ylk xk + yik ylk xk
j2J {k}
TH
yik xl xi ylk xl yik
xi + xj =
ylk ylk ylk
j2J {k}
⇣ ⌘
xi ylk xl yik
For feasibility the new solution x0 = ylk
should be non negative that is,
✓ ◆
xi ylk xl yik
0
ylk
Which implies that,
xi
yik
-M
xl
ylk
and therefore the criterion for entry of a variable in the basis set of the tableau is given by,
⇢
xl xi
= min 8 yik > 0
ylk i2 I yik
TC
Theorem 3.16. For a maximisation linear programming problem a necessary and sufficient
condition for the solution to be optimal is that zj cj 0 for all j = n m, . . . , n.
Solution:
K
5
2. write the LP problem in matrix form where identify B, & R and finally put the
information in the tableau as follows;
20
(i) Initial and the following tableaux.
5 2 2 0 0
cBj x1 x2 x3 x4 x5 x
H2
0 x4 1 2 -2 1 0 30
0 x5 1 3 1 0 1 36
Zj c j -5 2 2 0 0 0
5 x1 1 2 -2 1 0 30
0 x5 0 1 3 -1 1 6
MT
Zj c j 0 8 -12 5 0 150
8 1 2
5 x1 1 3 0 3 3 34
1 1 1
2 x3 0 3 1 3 3 2
Zj c j 0 12 0 1 4 174
Thus the optimal solution is x?1 = 34, x?2 = 0, x?3 = 2, x?4 = 0, x?5 = 0 and
C-
z = 174
Example 3.7. For the following LP problem,
x1 x2 4
3x1 + 4x2 + x3 1
x 1 , x2 , x3 0
Solution:
x1 x2 + x5 = 4
3x1 + 4x2 + x3 + x6 = 1
x 1 , x2 , x3 , x4 , x5 , x6 0
5
2. write the LP problem in matrix form where identify B, & R and finally
put the information in the tableau as follows;
20
(i) Initial and the following tableaux.
7 9 3 0 0 0
cBj x1 x2 x3 x4 x5 x6 x
H2
0 x4 5 -4 -1 1 0 0 10
0 x5 1 -1 0 0 1 0 4
0 x6 -3 4 1 0 0 1 1
Zj c j 7 9 3 0 0 0 0
0 x4 2 0 0 1 0 1 11
MT
1 1 1 17
0 x5 4 0 4 0 1 4 4
3 1 1 1
9 x2 4 1 4 0 0 4 4
1 3 9 9
Zj c j 4 0 4 0 0 4 4
0 x4 2 0 0 1 0 1 11
0 x5 1 -1 0 0 1 0 4
C-
3 x3 -3 4 1 0 0 1 1
Zj c j 2 3 0 0 0 3 0
0 x4 0 3
7 x1 1 -1 0 0 1 0 4
3 x3 0 13
MT
Zj c j 0 1 0 0 2 3 11
Thus the optimal solution is x?1 = 4, x?2 = 0, x?3 = 13, x?4 = 3, x?5 = 0, x?6 = 0
and z = 11
SUMMMARY OF PROCEDURE.
K-
n o
3. For the vector out of the basis we use min yxiki 8 yik 0
i2I
5
Exercise 3.1. For the following LP problems, find their corresponding optimal
solutions using the pimal simplex method(the simplex method),
20
(i)
H2
2x1 + 2x2 + 4x3 5
3x1 + x2 x3 7
x 1 , x2 , x3 0
(ii)
MT
max z = 3x1 + x2 + x3
s.t x1 x2 + 2x3 3
2x1 + 3x2 x3 2
3x1 + x2 2x3 1
x 1 , x2 , x3 0
C-
(iii)
max z = x1 2x2 + x3
s.t x1 + 2x2 + x3 5
2x1 x2 + x3 3
MT
x1 + x2 2x3 2
x 1 , x 2 , x3 0
(iv)
5
4 Degeneracy and Cycling
20
Definition 4.1. For a linear programming problem with m constraints (ex-
cluding the non- negativity restrictions) we say that a basic feasible solution
is degenerate if less than m of the basic variables are positive or we say that
a solution to a linear programming problem is degenerate if atleast one of the
basic variables takes on a value zero.
H2
The likely occurence of a degenerate solution is due to the occurence of a tie in
calculating ✓ ◆
xl xi x0
✓= = min = l
ylk yik yik yl 0 k
then only one of xl and xl0 can leave the basis, leaving the other variable in
MT
the basis with value zero. since xB 0, the variable with value zero is the one
which leaves the basis.
If xl is the one left in the basis with value xl = 0,(when xl0 leaves the basis),
then the next simplex iteration is,
✓ ◆
xl xi
= 0 = min provided yik > 0.
ylk yik yik
C-
if this is the case then the new value of z after xl has left the basis is,
✓ ◆
0 xl
z = z + (ck zk ) =z
ylk
thus when there is a degenerate solution there may be no change in the value
of z,
MT
using the primal simplex method the assumption has been that there exists m
basis vectors. suppose that we have less than m vectors in the basis then we
introduce another variable to make them m.
5
4.1.2 The method
Consider the standard linear programming problem with the number of basis
20
vectors less than m be given by
Max z = cx (12)
H2
s.t Ax = b
and x 0
Introduce extra variables in the constraints that do not have basic variables so
that the LP problem is transformed to,
MT
k
X
Max z = cx M si (13)
i=1
s.t Ax + si b
and x, si 0
Definition 4.3. The variable introduced in the Lp problem (13) to make the
number of basic variables m is called an artificial varible.
Note 4.1. M is a relatively large positive number so that it will be larger than
any number it will be compared with during the carrying out of the simplex
algorithm computations.
K-
Example 4.1. Solve the following linear programming problem using the Big
M-method
6x1 + 4x2 24
x 1 , x2 0
Solution
5
(a) Convert the LP problem into standard form by supplying slack variables.
20
s.t 2x1 x2 + x3 = 8
6x1 4x2 + x4 = 24
x 1 , x2 , x3 , x4 0
H2
(b) Ensuring feasibility implies that one of the equations has no basic variable
thus, we introduce an artificial variable x5 .
MT
6x1 + 4x2 x4 + x5 = 24
x 1 , x 2 , x 3 , x4 , x5 0
2 5 0 0 -M
cBj xB x1 x2 x3 x4 x5 x
C-
0 x3 2 -1 1 0 0 8
M x5 6 4 0 -1 1 24
z j cj -6M - 2 -4M - 5 0 M 0 -24M
4 1 1
0 x3 0 3 1 6 6 4
MT
2 1 1
2 x1 1 3 0 6 6 4
11 1
z j cj 0 3 0 3 ? 8
3 1
5 x2 0 1 4 8 ? 3
2 x1 1 0 2
11 1
z j cj 0 0 4 6 ? 19
Thus the optimal solution is x⇤1 = 2, x⇤2 = 3, x⇤3 = 0, x⇤4 = 0, x⇤5 = 0 and
K-
z = 19
Exercise 4.2. Solve the following Lp problems using the Big - M method( by
the use of artificial variables).
MA
1.
max z = 3x1 x2
s.t x1 + x 2 1
5
x1 + 2x2 8
x1 2
20
x 1 , x2 0
2.
H2
s.t 2x1 + x2 + 4x3 15
3x1 4x2 + 5x3 12
4x1 + 5x2 6x3 9
x 1 , x2 , x3 0
MT
4.2 The two phase simplex method
In this method, we consider a linear programming problem in its standard form
with the number of basic variables less than the number of equalities.
Since some equalities in (I) do not have basic variables we use artificial variables
S and thus (I) is transformed to,
X
Max z = cx si
i
s.t Ax + si = b (II)
and x, si 0
K-
X
Max z = si
i
MA
s.t Ax + si = b
and x, si 0
Possible cases.
5
(a) If from phase I 9 some si 6= 0, then the original linear programming
problem has no basic feasible solution (the solution is un bounded).
20
(b) If from phase I, si = 0 8 i then we solve the LP in (II) using the basic
variables obtained from phase I. hereby refered to as Phase II.
Example 4.2. Using the two phase simplex method solve the following Lp
problem
H2
max z = x1 3x2 6x3
s.t x1 + 3x2 2x3 9
3x1 x2 + 2x3 1
2x1 + 2x2 + x3 = 4
MT
x 1 , x2 , x3 0
Solution
In phase I we solve,
max z = x6
s.t x1 + 3x2 2x3 + x4 = 9
3x1 + x2 2x3 + x5 = 1
2x1 + 2x2 + x3 + x6 = 4
x 1 , x2 , x3 , x4 , x 5 , x 6 0
K-
Transform the information into the tableau and use the simplex method to
obtain,
MA
5
cj 0 0 0 0 0 -1
cBj xB x1 x2 x3 x4 x5 x6 x
20
0 x4 1 3 -2 1 0 0 9
0 x5 3 1 -2 0 1 0 1
-1 x6 -2 2 -1 0 0 0 4
z j cj 2 -2 3 0 0 0 -4
0 x4 0 0 4 1 -3 0 6
H2
0 x2 -3 1 -2 0 1 0 1
-1 x6 4 0 5 0 -2 1 2
z j cj -4 0 -5 0 2 0 -2
4
0 x4 5 0 0 1 - 75 - 45 22
5
0 x2 - 25 1 0 0 1
5
2
5
9
5
MT
0 x3 - 25 0 1 0 - 25 1
5
2
5
z j cj 0 0 0 0 0 1 0
Phase II
cj -1 -3 -6 0 0 -1
cBj xB x1 x2 x3 x4 x5 x6 x
4
0 x4 5 0 0 1 - 75 - 45 22
5
C-
2 1 2 9
3 x2 -5 1 0 0 5 5 5
6 x3 - 25 0 1 0 - 25 1
5
2
5
7 9 39
z j cj 5 0 0 0 5 ? 5
feasible.
The optimal solution is x⇤1 = 0, x⇤2 = 95 , x⇤3 = 2
5 and maximum value is 39
5.
Exercise 4.3. State the dual to the following LP’s and use thetwo phase
simplex method to find optimal solutions to the corresponding LP’s,
(i)
K-
(ii)
5
s.t x1 x2 + x3 + x4 1
x1 x2 + 2x4 3
20
x 1 , x2 , x3 , x4 0
H2
MT
C-
MT
K-
MA
in their contraints
X1 + X + x2 + S = 225
X 2[225 -
X11X2) , 0
maxz =
- a4
phase I ↓
O O E 8 O -
1 O
21 x2Si S2 S3 an ey
0 O O 600
8 Si 21 I O
01 O O 225
o S2 I I 0
O 1000
0 S3 54 o 0 11
I 2 E
-
I 150
-
194 O O O
158
-
-1
-
2 o 0 O O
Zj -
Cj
I
3 I O 525
O
Si 12 O O
I
o S2 Ye 0 6 O
- 150
O O I 22 700
S3 O
-
3 O
0x2 Y I 06 8 t - 75
Zj -
cj g O 000 I O O
ri-Rit
R2o Ry -
>
-
R
130-4RY-R3
max z = 301 + 422
↓
Phase I
Ni H2 Si S2 S3 e4 RHS
O 3
Y
S . O I O O 525
I
Ye * O 150
-
O 52 O
0 oo ↑ 700
S3 3 O 2
75
22 I
-
↑ 22 I 00 G
I 000 2 300
Zj Cj 8
- -
-
1 1 O 375
-
Si I O ⑧
O
o I O O 20 I 300
ey
O
S3 I
004 I O 100
4 22
I I O 10 O 225
O 8 900
I V 4 E
o f Riv
2 R2 -Ri
-12
N
0
RI
0 -
22
R3
*
375
si =
e = 300
*
S3 = 150
x = 225
Two phase method is an alternative for the
big Mmethod
So we use too phase method for up's that have or
in their contraints
di
max z = 301 + 422
X1 + X + x2 + S = 225
X 2[225 -
Twopgs i
5x + y(2 < 1000
> + 2x23 + 50
>
-
S x + 47 + 53 = 1000
(of
c +2x2 Cy + ay 150
-
=
>
-
X11X2) , 0
li 51 Sa say ey RHS
-
s 100 O 8 600
0100 O 225
5 5400 1 O O 1000
15
%2 =75
2 an i 2000 I -
I 150 S
Z O 0 000
-
I O B
~
525
3 E
W 8
Si o I 0
t Si
*
= 525
D + R, S2 Y E
130 Sc=
I
-
o 01 O - 130
3000
=
S3 1 -2
critri Xa
*
= 7S
*
-
75
O
Det Y 00 0
X*
·
=
e a = = o
,
O
Ri + z
of obj
-
the value
& is zero which Implies
the table is optimal the value of the artificial
variable is zero . Thus
the problem has a
feasible solution .
RHS
↑
130
S2 Yo E
o
10-1
2
700
S3 3 000 1-2
Y 8 O 0 * 75
Z 00 ① 00 -
1 8 O
8
34000
-
Iey
x( C22 51 S2 53
s
I test
&
1650
si E 525 min
52% 5
8 :
O I O .
252 o 01 o
130
S 15
%. S = 300
700
S33 000
2
I
700/2 = 350
Y 8 O 0 -z 75
-
O If
Z
4 you compara
① 8
-
3
-
O 8
53 I 00
-
225
*
* es = O
21 I 010 8
225 2 =
more
950
ID z = 900
2D ?
S
-
GRc + R3
R2 trip
there a
feasible
is solt
9
eliminate the column
·
elated to the artificial
no variable and move on
the next phase
no feasible soli
e >o
9
eliminate the re
on to the
second
phase
Makerere University MTH2205 - LINEAR PROGRAMMING
5
5 Duality of LP problems
20
Economic theory indicates that scarce (limited) resources have value. For ex-
ample, prime agricultural van capacity is limited and has value (a rental price).
On the other hand, air is e↵ectively unlimited and therefore does not have a
market value. In LP models, limited resources are allocated, so they should be,
valued. Whenever we solve an LP problem, we implicitly solve two problems:
H2
the primal resource allocation problem, and the dual resource valuation prob-
lem. This chapter covers the resource valuation, or as it is commonly called,
the Dual LP problem and its relationship to the original, primal, problem.
MT
solving the dual of any problem, one simultaneously solves the primal. Thus,
duality is an alternative way of solving LP problems. However, given today’s
computer capabilities, this is an infrequently used aspect of duality. Therefore,
we concentrate on the study of duality as a means of gaining insight into the
LP solution.
1. The following is the canonical form of duality that is the primal and the
C-
dual problems,
(i) Primal LP problem,
max z = cx
s.t Ax b
MT
and x 0
min w = ub
s.t uA c
and u 0
K-
2. The following is the standard form of duality that is the primal and the
dual problems,
(i) Primal LP problem,
MA
min z = cx
s.t Ax b
and x 0
05
(ii) Dual LP problem,
max w = ub
s.t uA c
and uunrestricted
22
Example 5.1. The primal LP problem,
TH
25x1 + 20x2 + 19x3 280
x 1 , x2 , x3 0
u1 , u2 unrestricted
MA
5
• There is a one-to-one correspondence between the primal constraints
and the dual variables; i.e., u1 is associated with the first primal con-
20
straint, u2 with the second primal constraint, etc.
• Dual variables (ui ) can be interpreted as the marginal value of each
constraint’s resources. These dual variables are usually called shadow
prices and indicate the imputed value of each resource.
• A one-to-one correspondence also exists between the primal variables
H2
and
P the dual constraints; x1 is associated with the first dual constraint
P
ui ai1 c1 , x2 is associated with the second dual constraint ui ai2
c2 .
Note 5.2. In order for one to be able to convert any LP problem to the the
MT
dual form it has to first be written in either the canonical form or standard
form.
Theorem 5.1. The dual of the dual problem is the primal problem ie DDP )
P
Theorem 5.2. (Fundamental theorem of Duality)
If x and u are corresponding feasible solutions to a pair of primal and dual
programs, then cx ub.
C-
Theorem 5.3. If x and u are dual feasible solutions satisfying the relation
cx = ub, then these are optimal solutions.
Theorem 5.4. If the solution to P is not bounded then DP has no feasible
solution and if also the solution to the dual problem problem is unbounded then
MT
Theorem 5.6. The optimal value to the dual problem is given by u = (zj
cj ) 8 j in the optimal tableau of the primal problem and it depends on the
initial basis vectors for the primal problem.
Note 5.3.
(i) Given a pair of dual problems, a necessary and sufficient condition for a
MA
5
(ii) The solution x(u) is itself an optimal solution, thus this means that the
simplex method solves both the primal and the dual LP problems.
20
Example 5.3. Consider the LP problem,
max z = 2x1 x2
s.t x1 + x2 2
H2
x1 + x2 1
3x1 2x2 5
x 1 , x2 0
MT
min w = 2u1 + u2 + 5u3
s.t u1 u2 + 3u3 2
u1 + u2 2u3 1
u1 , u2 , u3 0
Using the simplex method a solution the primal problem the last tableau is,
2 1 0 0 0
C-
cBj x1 x2 x3 x4 x5 x
3 1 1
1 x2 0 1 5 0 5 5
1 2 13
0 x4 0 0 5 1 5 5
2
2 x1 1 0 5 0 15 9
5
1 3 17
Zj c j 0 0 0 5
MT
5 5
(i) In most times the primal simplex algorithm keeps the primal problem
feasible at all steps ( ie xi 0) and when we achieve zj cj 0 then the
primal problem is optimal.
(ii) The implication of zj cj 0 about dual feasiblity.
from zj cj = cB yj cj so zj cj 0 ) cB Y c 0 that’s cB Y c
MA
5
(iii) A basic solution is optimal if and only if it is both dual and primal feasible.
The dual simplex method starts with the dual feasible solution and maintains
20
its dual feasibility at all iterations and tries to attain primal feasibility( ie
xi 0 8 i). The dual simplex method is carried out in the same tableau as
the primal simplex method.
H2
(i) Start with a tableau in which zj cj 0 for j = 1, 2, 3, . . . , n that is write
the problem in a form with dual feasibility if possible.
(ii) If xBi 0 for i = 1, 2, 3, . . . , m then the problem is optimal. If not fix an
xk < 0 such that xk = min(xi ) or xk = max |xi | for xi < 0 and the
variable xk is to become a non basic variable.
MT
(iii) Exit criterion: Select a value of xi < 0 such that xk selected is minimum.
(iv) Entry criterion
⇢
zk ck zj cj zj cj
= min or max
ylk ylj <0 ylj ylj <0 ylj
(v) The usual simplex algorithm works thereafter and back to (i).
C-
Example 5.4. Find the optimal solution to the following LP problem using
the simplex algorithm,
min w = 2x1 + 3x2 + 3x3
s.t 2x1 3x2 + x3 4
MT
x1 + x2 + 2x3 3
x 1 , x2 , x3 0
Solution
write the LP problem as a maximisation problem as follows;
max w = 2x1 3x2 3x3
s.t 2x1 + 3x2 x3 4
K-
x1 x2 2x3 3
x 1 , x2 , x3 0
Re- write the LP problem in standard form with slack variables as follows,
max w = 2x1 3x2 3x3
MA
5
Transform the information into the tableau and use the dual simplex method
to obtain,
20
2 3 -3 0 0
cBj x1 x2 x3 x4 x5 x
0 x4 -2 3 -1 1 0 -4
0 x5 -1 -1 -2 0 1 -3
Zj c j 2 3 3 0 0 0
H2
3 1 1
2 x1 1 2 2 2 0 2
5 3 1
0 x5 0 2 2 2 1 -1
Zj c j 0 6 2 1 0 4
7 2 1 5
2 x1 1 3 0 3 3 3
5 1 2 2
3 x3 0 3 1 3 3 3
MT
8 1 4 16
Zj c j 0 3 0 3 3 3
The optimal solution therefore is x?1 = 53 , x?2 = 0, x3 = 23 , x?4
?
= 0, x?5 = 0 and
w = 16
3
Exercise 5.1. Solve the following LP problems using the Dual simplex method,
(i)
min w = 2x1 + 15x2 + 18x3
C-
s.t x1 + 2x2 6x3 10
x2 + 2x3 6
2x1 + 11x3 19
x1 + x2 2
MT
x 1 , x2 , x3 0
(ii)
max z = 5x1 35x2 20x3
s.t x1 x2 x3 2
x1 3x2 3
x 1 , x2 , x3 0
K-
(iii)
max w = 2x1 + 3x2
s.t x1 + x2 5
x1 + 3x2 35
MA
x1 20
x1 + x2 2
x 1 , x2 0
5
(iv)
max w = x1 + x2
20
s.t 3x1 + x2 12
3x1 + 5x2 12
x 1 , x2 0
H2
MT
C-
MT
K-
MA
S .
t -
1000
Sx, + 47z [ -
min 3 + 2x2x150
x x2)/ 8
c( + 2x27150 ,,
04 , %(2), 0
Max W -
= 600y -
22592-1000y2 +
150Y4 Max W =
·
600y- 22542-1000Y2 +
150y4
2y1 yz Syztyy
-
zy1 yz Syztyy + S1 3
- -
-
13 =
- -
y 4yz y yz 4y3 +
2y4
-
yz
. -
4
-
+ = +2
2yy 4
-
- . -
Ye ye Y3 , ,
,
Yy 30
Ye ye Y3, ,
,
Yy 30
S2 RHS
y ,
ye yo Yy S1
S -
2 +
-
51 10 3
5 11-42
o I Y
S .
t Conditions
= 600
2 x1 + Xe
x + x2[225
1000
Sx, + 47z [
in one
c( + 2x27150 2 or :
04 , %(2), 0 constraint
Min E = 3x + 4x2
S .
t
+ 600
2x , (2 + S =
x1 + x2 + 52 = 22S
+ S3 1000
5x + yx2 =
2x2 + S4 = 150
x -
-x y
-
2x2 = 150
-
-
-
·
/
d ea Si S2 Sa Su
RHS -
optimal
pirof
600
000
- atleast
min test
225 one negative
1000231] (infeasible
- problem)
Z 3
4 00 0
solved usinaplex
-
0 I
-
525
positive
I
Si I .
S o
1 0 0S au
S2 03 130 a method-
·wea
05 0 0 1 0
2 750 reared me
533000 I
00 0 -04 75
22 05 I Condition 4 Ri + R - R3 &
+Ry
·
z -
100 00
-
2300 and z
*
= 300
or
2R4
S
~ Ru
-2
N O
-
By + R3
Ry + 2
-
0
,
12Ry + zo
Makerere University MTH2205 - LINEAR PROGRAMMING
5
6 Sensitivity Analysis
20
We note that the conditions under which the optimal solution to a Linear
programming problem is obtained might change with time. If there are such
changes we may have to revise the problem and/or the solution. Some of the
possible changes that may occur and the corresponding techniques that could
be used to revise the solution are given in the following subsections.
H2
1. Change in ck .
(i) When xk is a non - basic variable then the change is only in the di↵er-
ence zk ck , thus if ck changes to c0k the new value of zk ck is zk c0k
and the previous solution is still optimal if zk c0k 0.
MT
(ii) When xk is a basic variable then, since zj depends on ck when xk is
in the basis, each zj will change and hence to find out whether the
previous solution is still optimal we recalculate zj cj for all j, then
the previous solution is still if zj cj 0 8 j otherwise it’s not.
2. Change in bi (b)
Since the aij , zj and the cj donot depend on b, a change in b would only
change the values of the basic variables xB = B 1 b. So if B 1 can be
C-
found then the new values x = B 1 b can be calculated to check on feasility.
Recall the matrix B is formed of the columns which correspond to the basic
variables, and hence B 1 can be found or can be read o↵ from the tableau
provided R was initially a unit matrix.
MT
3. Change in aik when xk is a non - basic variable, The basic matrix B doesnot
change and therefore xB = B 1 b remains the same, that is the solution is
still feasible.
Now consider zk ck = cB B 1 a0k ck where it is only ak that changes then
only zk ck will change impying we need to find the new value of zk ck ,
if it’s non negative, the previous solution is still optimal otherwise xk is
going to enter the basis, the new column yk being yk0 = B 1 a0k and use this
new value of yk to find new values of zk ck thus zk0 c0k and continue with
K-
5
of the change in B 1 thus the primal may become either primal infeasible
or dual infeasible or both.
20
How to improve on the solution;
(i) Using the old B 1 calculate yk0 to replace yk (which is a unit vector)
in the current tableau and also calculate zk0 c0k
(ii) Since xk is in the basis, column yk0 should be a unit vector with the
H2
0
unit 1 in the xth th
k row and xk column. So we divide the xk row by ykk
and compute the other elements of the tableau by Jordan - Guass row
elimination ( or by pivoting technique). Further depending on whether
the new tableau is primal infeasible or dual infeasible we apply the
dual simplex algorithm or the primal simplex algorithm to improve
MT
the solution. In cases where it is neither primal or dual infeasible, we
can apply the two algorithms, one after the other (i.e first make one
of the two problems feasible and then proceed to make the other one
feasible)
(4) Addition of a new constraint.
Addition of a new constraint will reduce the value of the objective func-
tion(for a maximisation problem), otherwise there is no change in the value
C-
and then the previous solution is still optimal. Here we check whether the
solution still satisfies the new constraint. If the solution doesnot satisfy
the new constraint then it is not optimal with the new constraint. In this
case we introduce a slack variable into the new constraint and make it be
in the basis. since the old solution doesnot satisfy the new constraint the
MT
slack variable that is pushed into the basis will take on a negative value (ie
the solution is infeasible). It is then when we make use of the dual simplex
algorithm to find an optimal solution to the new problem.
(5) Addition of a new variable, Let ⌫ be introduced in the objective function
with a coefficient cv and in the constraints with coefficients ai⌫ (i =
1, 2, . . . , m). The previous solution plus ⌫ = 0 is an optimal solution to the
new problem provided z⌫ c⌫ 0. Thus we need to calculate z⌫ = cB B 1 a⌫
K-
iterations.
5
2 1 0 0 0
cBj x1 x2 x3 x4 x5 x
3 1 1
1 x2 0 1 0
20
5 5 5
1 2 13
0 x4 0 0 5
1 5 5
2 1 9
2 x1 1 0 5
0 5 5
1 3 17
Zj c j 0 0 5
0 5 5
H2
If z⌫ c⌫ < 0, then the previous solution is not optimal and ⌫ would
enter the basis at the next simplex iteration.
Example 6.1. For the following LP problem,
max Z = 2x1 x2
MT
subject to x1 + x2 2
x1 + x2 1
3x1 2x2 5
x 1 , x2 0
Let x3 , x4 and x5 be introduced as slack variables in the usual way. The corre-
sponding final tableau is as presented below: In each of the following changes
C-
of the problem determine whether or not the solution given by the final tableau
above remains [Link] not find the optimal solution, to the new problem,
(a) c1 changes to 2.
(b) b changes to (2, 1, 2) that’s b3 reduced by 3.
MT
max Z = 2x1 x2 + ⌫
subject to x1 + x2 + 2⌫ 2
x1 + x2 ⌫ 1
3x1 2x2 + ⌫ 5
x 1 , x2 , ⌫ 0
K-
In this show further that the optimal solution is not unique and determine
one in which ⌫ is a basic variable.
(d) If we add another constraint x1 + 2x2 2.
MA
(e) With the new problem in (c) the first constraint becomes x1 + 2x2 + 2⌫ 2
[Start with the solution in which ⌫ is basic]
(f) Third constraint becomes 2x1 2x2 + ⌫ 5.
5
Solution
20
0, z3 c3 = 75 , z4 c4 = 0, z5 c5 = 15 and the new value of z is 19 5.
Hence x3 will enter the basis and x2 will leave the basis. Replacing the old
values of the zj cj by the new variables, we have the revised tableau and
by applying the simplex algorithm, we obtain the new optimal solution.
H2
Thus,
2 1 0 0 0
cBj x1 x2 x3 x4 x5 x
3 1 1
1 x2 0 1 5 0 5 5
1 2 13
0 x4 0 0 1
MT
5 5 5
2 1 9
2 x1 1 0 5 0 5 5
7 1 19
Zj c j 0 0 5 0 5 5
5 1 1
0 x3 0 3 1 0 3 3
1 1 8
0 x4 0 3 0 1 3 3
2 1 5
2 x1 1 3 0 0 3 3
7 2 10
Zj c j 0 3 0 0 3 5
0 x3 1 1 1 0 0 2
C-
0 x4 -1 1 0 1 0 1
0 x5 3 -2 0 0 1 5
Zj c j 2 1 0 0 0 0
2, x4 = 1, x5 = 5, z = 0.
(b) b changes to (2, 1, 2) that’s b3 reduced by 3.
0 1
2
When b changes to b = @ 1 A, The new x̄0B = B 1 b. i.e
2
0 3 1
10 1 0 4 1
K-
5 0 5 2 5
x̄B = @ 5 1 5 A @ 1 A = @ 1 A
0 1 2
2
5 0 15 2 6
5
x1 = , x2 = , x3 = 0, x4 = 1, x5 = 0, z = +0+ =
5 5 5 5 5
5
(c) A new variable ⌫ introduced such that the problem becomes,
max Z = 2x1 x2 + ⌫
20
subject to x1 + x2 + 2⌫ 2
x1 + x2 ⌫ 1
3x1 2x2 + ⌫ 5
x 1 , x2 , ⌫ 0
H2
In this show further that the optimal solution is not unique and determine
one in which ⌫ is a basic variable.
The new column introduced is
0 1
2
MT
av = @ 1 A
1
So the corresponding column in the final tableau
0 3 1
10 1 0 1
5 0 5 2 1
yv = B 1 av = @ 15 1 25 A @ 1 A = @ 1 A
2
0 15 1 1
C-
5
2 1 1 0 0 0
cBj x1 x 2 v x3 x4 x5 x
1 x2 0 1 1 35 0 1 1
5 5
1
0 x4 0 0 -1 5 1 25 13
5
2 x1 1 0 1 25 0 15 9
5
Zj c j 0 0 0 15 0 35 17
5
1 v 0 1 1 35 0 1 1
5 5
0 x4 0 1 0 25 1 51 14
K-
5
1
2 x1 1 -1 0 5 0 25 8
5
1 3 17
Zj c j 0 0 0 5 0 5 5
17
So another optimal solution is z = 5 , x1 = 85 , x2 = 0, v = 15 , x3 = 0, x4 =
14
5 , x5 = 0.
MA
5
9 1
solution given must satisfy the constraint. With x1 = 5 , x2 = 5 , x3 =
0, x4 = 1, x5 = 0,
9 2 11
20
x1 + 2x2 = + = >2
5 5 5
So the solution is no longer optimal.
Introducing the slack variable s we have
H2
x1 + 2x2 + s = 2
2 1 0 0 0 0
cBj x1 x2 x3 x4 x5 s x
3 1
1 x2 0 1 5 0 5 0 15
1
0 x4 0 0 1 25 0 13
MT
5 5
2
2 x1 1 0 5 0 15 0 95
0 s 1 2 0 0 0 1 2
1
Zj c j 0 0 5 0 35 0 17
5
Since x1 and x2 are in the basis, we eliminate them from the equation by
subtracting (last row+ twice first row of the given final tableau) from the
last equation to get
C-
2 1 0 0 0 0
cBj x1 x2 x3 x4 x5 s x
3 1
1 x2 0 1 5 0 5 0 15
1
0 x4 0 0 5 1 25 0 135
MT
2
2 x1 1 0 5 0 15 0 59
8
0 s 0 0 5 0 15 1 1
5
1
Zj c j 0 0 5 0 35 0 517
We notice that the fourth row has x̄ < 0, we apply the dual simplex method
to find the new optimal solution. Thus,
K-
MA
5
2 1 0 0 0 0
cBj x1 x2 x3 x4 x5 s x
20
3 1 1
1 x2 0 1 5 0 5 0 5
1 2 13
0 x4 0 0 5 1 5 0 5
2
2 x1 1 0 5 0 15 0 9
5
8
0 s 0 0 5 0 15 1 1
5
1
Zj c j 0 0 0 35 0 17
H2
5 5
1 3 1
1 x2 0 1 0 0 8 8 8
0 x4 0 0 0 1 38 8
1 21
8
2 x1 1 0 0 0 14 1
4
7
4
1 5 1
0 x3 0 0 1 0 8 8 8
5 1 27
Zj c j 0 0 0 0 8 8 8
MT
So the optimal solution to the new problem is
7 1 1 21 27
x1 = , x2 = , x3 = , x4 = , x5 = 0, s = 0, z = .
4 8 8 8 8
(e) With the new problem in (c) the first constraint becomes x1 + 2x2 + 2⌫ 2
[Start with the solution in which ⌫ is basic]
It is a12 which changes. But since x2 is non basic x̄B = B 1 a12 does not
C-
change; zj cj do not change except z2 c2 . To test whether this change
would a↵ect the solution, we consider the new dual constraint 2u1 + u2
2u3 1 ( to replace u1 + u2 2u3 1). The current dual solution is
1 3
u1 = 5 , u2 = 0, u3 = 5 , u4 = 0, u5 = 0.
Substituting in the new second constraint,
MT
2 6 4
+0 = > 1
5 5 5
So both the dual problem and the primal problem are still feasible. This
implies that the current primal solution is still optimal.
(f) Third constraint becomes 2x1 2x2 + ⌫ 5.
In this case it is a31 which has changed. Since x1 is basic, this change
K-
may a↵ect both feasibilities. From the current tableau in which v is basic
variable, 0 3 1
1
5 0 5
B = 1 @ 2
1 5 1 A
5
1 2
5 0 5
MA
So 0 3 10 1 0 1 1
1
5 0 5 1 5
y10 = @ 25 1 15 A @ 1 A = @ 51 A
1 2 3
5 0 5 2 5
5
Therefore, z10 c01 = 15 + 0 + 65 2 = 53 Thus, the solution is no longer dual
feasible. So putting y10 and z10 c01 into the tableau we get
20
2 1 1 0 0 0
cBj x1 x2 v x 3 x4 x5 x
1
1 v 5 1 1 35 0 1 1
5 5
1
0 x4 5 1 0 25 1 51 14
5
H2
3 1
2 x1 5 -1 0 5 0 25 8
5
1 3 17
Zj c j 0 0 5 0 5 5
We make the column vector for the variable x1 unity to obtain the following
2 1 1 0 0 0
MT
cBj x1 x2 v x3 x4 x5 x
4 2 1 1
1 v 0 3 1 3 0 3 3
2 1 1 10
0 x4 0 3 0 3 1 3 3
5 1 2 8
2 x1 1 3 0 3 0 3 3
Zj c j 0 -1 0 0 0 1 5
3 1 1 1
1 x2 0 1 4 2 0 4 4
1 1 7
0 x4 0 0 0 1
C-
2 2 2
5 1 1 9
2 x1 1 0 4 2 0 4 4
9 3 1 17
Zj c j 0 0 4 2 0 4 4
0 x5 0 -4 -3 -2 0 1 1
0 x4 0 2 1 1 1 0 3
2 x1 1 1 2 1 0 0 2
MT
Zj c j 0 3 3 2 0 0 4
x1 = 2, x2 = 0, x3 = 0, x4 = 3, x5 = 1, v = 0, z = 4.
x 1 , x 2 , x3 0
Let x4 , x5 and x6 be introduced as slack variables in the usual way. The corre-
sponding final set of the equations yielding the optimal solution is:
5
4 2 1
x1 + x3 + x4 + x5 = 4
20
5 5 10
2 1 3
x2 + x3 + x4 + x5 = 5
5 5 10
1
2x3 + x4 x5 + x6 = 14
2
H2
(a) What is the optimal solution ( the optimal values for Z, x1 , x2 , x3 , x4 , x5 , x6 )?.
(b) What is the corresponding dual model?.
(c) what is the optimal solution for the dual model?.
MT
(d) Considering Z as profits in shillings, what would be the contribution to
the profit if one more unit of resource A were made available?.
Answer the same question for resources B and C.
(e) suppose that more recent data have led to the following revision of the
original objective function to Z = x1 + 3x2 + x3 , Is the old solution in
part (a) still optimal? If not, find the new optimal solution.
C-
(f) Repeat (e) with the objective function revised to Z = x1 + x2 2x3 .
(g) If one finds that only 10 units of resource B are available, does the same
basis at new values remain optimal?.if so, what are the new values?.
(h) If the constraint for resource C were really 4x1 + 3x2 + 7x3 10 would
MT
the old solution remain optimal? if not, find the new optimal solution.
(i) Repeat (h) for constraint for resource C as 4x1 + 3x2 + 8x3 10.
(j) suppose it was discovered that a fourth activity ( whose level is denoted
by x7 is relevant and that the appropriate model should be,
K-
x 1 , x2 , x3 , x7 0
Is the old solution, plus x7 = 0, still optimal? if not, find the new optimal
solution.
5
(k) would the additional constraint x1 + x2 + x3 8, change the optimal
solution? if so, find the new optimal solution.
20
( Hint: No extensive calculations are necessary or desired for any of these
parts).
H2
MT
C-
MT
K-
MA
5
ASSIGNMENT
20
max Z = x1 2x2 + x3
subject to x1 + 2x2 + x3 5 (resource A)
2x1 x2 + x3 3 (resource B)
H2
x1 + x2 2x3 2 (resource C)
x 1 , x2 , x3 0
Let x4 , x5 and x6 be introduced as slack variables in the usual way. The corre-
sponding final set of the equations yielding the optimal solution is:
MT
x1 + 3x2 + x4 x5 = 2
2x1 x2 + x3 + x5 = 3
5x1 x2 + 2x5 + x6 = 8
(a) What is the optimal solution ( the optimal values for Z, x1 , x2 , x3 , x4 , x5 , x6 )?.
C-
(b) What is the corresponding dual model?.
(c) what is the optimal solution for the dual model?.
(d) Considering Z as profits in shillings, what would be the contribution to
the profit if one more unit of resource A were made available?.
MT
basis at new values remain optimal?.if so, what are the new values?.
(h) If the constraint for resource B were really 2x1 2x2 + x3 3 would the
old solution remain optimal? if not, find the new optimal solution.
(i) Repeat (h) for constraint for resource B as x1 2x2 + x3 3.
MA
5
(j) suppose it was discovered that a fourth activity ( whose level is denoted
by x7 is relevant and that the appropriate model should be,
20
max Z = x1 2x2 + x3 + 2x7
subject to x1 + 2x2 + x3 + x7 5 (resource A)
2x1 x2 + x3 2x7 3 (resource B)
x1 + x2 2x3 x7 2 (resource C)
H2
x 1 , x2 , x3 , x7 0
Is the old solution, plus x7 = 0, still optimal? if not, find the new optimal
solution.
(k) would the additional constraint x1 + x2 + x3 4, change the optimal solu-
MT
tion? if so, find the new optimal solution.