Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Simplex Method. Standard form.

Simplex Method.
General and Standard form of LP problem.

Economic Mathematical Methods 4. LP problem in general form.


It is a form that is obtained by converting verbal model into mathematical. It contains only
Simplex Method. structural variables. In a general form the constraints can contain all three types of relational
operators, i.e. the inequalities of ≤ and ≥ type and equations.

LP problem in standard form.


Pavel Kolman
It is a form, where all the constraints in the model are in the form of equations. It arises from the
general form, so that in inequalities of ≤ type we add, respectively in inequalities of ≥ type we
Department of Statistics and Operation Analysis
subtract additional variables.
FBE Mendelu
Meaning of additional variables can be interpreted as an unused resources. Therefore, the in
objective function it has zero coefficient. For additional variables we apply non-negativity
October 20, 2016 constraints.

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 1 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 2 / 29

Simplex Method. Canonical form. Simplex Method. Basic and non-basic variables.

Simplex Method. Simplex Method.


Canonical form of LP problem. Basic and non-basic variables.

LP problem in canonical form. Basic and non-basic variables.


In the canonical form are all constraints in the form of equations and is on the left side of the The LP problem of dimensions m × n in canonical form contains two types of variables:
constraints contained identity submatrix. • m basic variables, which form an identity submatrix and their value is equal to the
Direct method of conversion to canonical form. right-hand side value of the corresponding constraint,
If the problem has all the constraints in the form of inequalities ≤ type, by conversion to the • n − m non-basic variables, which do not form an identity submatrix and whose value is
standard form we obtain a canonical form. zero.
If there are artificial variables in the basis, the solution is infeasible. It becomes feasible
Indirect method of conversion to canonical form. after eliminating all artificial variables!
In the case where in the LP problem are constraints in the form of equations, respectively.
inequalities of ≥ type, we have to use artificial variables to get canonical form. Artificial variables
are added to the left sides of constraints, which were in general form equations, respectively.
inequalities of ≥ type. Thus we get the identity matrix and create so called artificial basis.
In the objective function will have an artificial variable prohibitive (ie. a disadvantageous) rate. In
maximization problems will have a value −M, in minimization +M (where M is a large number).
For artificial variables we also apply non-negativity constraints.
Before using the simplex method, it is necessary to have a LP problem in canonical form!

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 3 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 4 / 29
Simplex Method. Basic and non-basic variables. Simplex Method. Basic and non-basic variables.

Simplex Method. Simplex Method.


Example 4.1 – canonical form. Requirements on Simplex algorithm.

Example 4.1 – formulate a mathematical model and build the canonical form. Requirements on Simplex algorithm.
Agricultural cooperative has 10 hectares of arable land on which wants to grow medicinal plants: The simplex method is an universal method applicable to all types of LP problems, regardless
agrimony, chamomile and peppermint. Production costs must not exceed 27 thousand CZK, the number of variables and constraints. It is a deterministic iterative method, based on a simple
expected revenues from production should not fall below 65 thousand CZK. mathematical algorithm. This algorithm must fulfill all these requirements:
Agrimony Camonile Peppermint • resultativity requirement – we always get a concrete result
Costs in ths. CZK/ha 3 3 2 • unambiguous requirement – each step is exactly determined by the decision procedure
Revenues in ths. CZK/ha 6 10 5
Profit in ths. CZK/ha 3 7 3
• repeatability requirement – use of the same data gives always the same result

Determine the production structure in order to maximize profit from the production.
• universality requirement – the Simplex method can be used for all types of LP problems
The meaning of iterativity is, that after final count of iterations we always get an optimal solution
or we find out that the LP problem does not have (feasible or optimal) solution.

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 5 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 6 / 29

Simplex Method. Basic and non-basic variables. Simplex Method. Basic and non-basic variables.

Simplex Method. Simplex Method.


Number of basic solutions. Basic rules in the Simplex Method.

Number of basic solutions. Basic rules in the Simplex Method.


According to Frobenius theorema , the system of equations has infinitely many solutions, where The objective function value is different in each basic solution. It’s value depends on basic
n − m non-basic variables can take any value (e.g. zero). The m basic variables are equal to the variables. For finding the extreme objective function value, we use a simplex algorithm. It allows
right-hand side values of equations. This solution is one of basic solutions of the LP problem, us to go from the initial basic solution to the optimal solution (if it exists), and at every step of the
because we can combine basic and non-basic variables. The maximum count of basic solutions simplex algorithm get better value of objective function.
is determined by the equation:
  For use of the simplex algorithm, we need to know 3 rules:
n n!
= • Rule for testing optimality – we test, if a given solution is optimal or not.
m m! · (n − m)!
E.g., in LP problem with 8 variables and 4 constraints there are • Basis change rule – we decide, how to change basis, to improve the current solution. We
 
8! need to identify a variable, which comes into new basis and variable, which leaves the old
8
= = 70 basis.
4 4! · (8 − 4)!
• New basis conversion rule – using Gaussian elimination method we recalculate LP
basic solutions. It means, there is 70 combinations of basic variables.
problem to contain the new basic variable.
a
The system of m equations with n variables has solution, if and only if the A matrix
and expanded A|r matrix have the same rank. If h(A) = h(A|r ) = n, the system has just
one solution, if h(A) = h(A|r ) < n, the system has infinitely many solutions. For case
h(A) 6= h(A|r ) the system does not have a feasible solution.

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 7 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 8 / 29
Simplex Method. Basic and non-basic variables. Simplex Method. Algorithm of the Simplex Method.

Simplex Method. Simplex Method.


Flowchart algorithm of simplex method. The simplex method algorithm.

Flowchart algorithm of simplex method. The algorithm of simplex method.


Suppose LP problem in standard form with m constraints and n variables:
Start
zmax = c1 x1 + c2 x2 + . . . + cn xn
a11 x1 + a12 x2 + . . . + a1n xn = b1
Initial Basic Solution a21 x1 + a22 x2 + . . . + a2n xn = b2
.. .. . . .. ..
. . . . .
Optimality Test am1 x1 + am2 x2 + . . . + amn xn = bm
x1 , x2 , . . . , xn ≥ 0
Yes where m > n, and bi ≥ 0 for 1 ≤ i ≤ m.
Is Optimal? End
Further, suppose that in A matrix of structural coefficients:
No 
a11 a12 . . . a1n

 a21 a22 . . . a2n 
Find New Basis A= .

.. .. 

 .. ..
. . . 
am1 am2 . . . amn
Change Basis
first m columns are linearly independent.

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 9 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 10 / 29

Simplex Method. Algorithm of the Simplex Method. Simplex Method. Initial simplex table.

Simplex Method. Simplex Method.


Initial basic solution. Initial simplex table.

Initial basic solution. Initial simplex table:


Considering that first m columns is linearly independent, we can the system of linear equations To make the calculation more clear, we use simplex table. Simplex table is based on the
transform to the canonical form using Gaussian elimination: canonical form (it is a modified notation).
x1 + α1, m+1 xm+1 + . . . + α1p xp + . . . + α1n xn = β1
x2 + α2, m+1 xm+1 + . . . + α2p xp + . . . + α2n xn = β2 c1 c2 ... cm cm+1 ... cn
.. .. .. .. ~cBT ~
basis = β x1 x2 ... xm xm+1 ... xn
.. .. ..
. . . . . . . c1 x1 = β1 1 0 ... 0 α1,m+1 ... α1,n
xm + αm, m+1 xm+1 + . . . + αmp xp + . . . + αmn xn = βm c2 x2 = β2 0 1 ... 0 α2,m+1 ... α2,n
The first m variables x1 , x2 , . . . , xm , forming identity matrix, are called basic variables. .. .. .. .. .. .. .. .. ..
The all remaining n − m variables (xm+1 , . . . , xn ) are non-basic variables. . . . . . . . . .
cm xm = βm 0 0 ... 1 αm,m+1 ... αm,n
If we substitute all non-basic variables by zeros, whereas βi ≥ 0, we get initial basic solution.
This initial basic solution is determined by solution vector and objective function value. step 0 ~
zmax = ~cB · β ∆1 ∆2 ... ∆m ∆m+1 ... ∆n
The solution vector contains values of all variables:
~x = (x1 = β1 , x2 = β2 , . . . , xm = βm , xm+1 = 0, . . . , xn = 0). Index values:
∆j = zj − cj = (~cB · α
~ j ) − cj ,
The objective function value is calculated as: 
for example ∆m+1 = c1 · α1,m+1 + c2 · α2,m+1 + · · · + cm · αm,m+1 − cm+1
zmax(min) = c1 β1 + c2 β2 + · · · + cm βm .

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 11 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 12 / 29
Simplex Method. Optimality test and basis change. Simplex Method. Pivot cell.

Simplex Method. Simplex Method.


Optimality test and basis change. Pivot cell.

Otimality test: Pivot column:


• maximization problems: all index values must be non-negative, i.e. ∀∆j ≥ 0, specifies the variable that enters the basis
• minimization problems: all index values must be non-positive, i.e. ∀∆j ≤ 0. • maximization problems: 
looking for the smallest ∆j from negative, i.e. min ∆j , for ∆j < 0,
Basis change: • minimization problems: 
looking for the largest ∆j from positive, i.e. max ∆j , for ∆j > 0.
If the optimality test is broken we will change the basis make the next step in the calculation of
the simplex method, so as to improve the objective function value. Basis change is determined by
the pivot cell. Pivot row (if the pivot column is k):
specifies the variable that leaves the basis
( )
Pivot cell: βi
• identical for maximization and minimization problems: min , for αi,k > 0.
It is the intersection of the pivot column and pivot row. When determining the pivot is initially αi,k
determined pivot column, followed by the pivot row. In the position of the pivot it will be in the next
step value of 1 and at other positions in the pivot column there will be zeros.

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 13 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 14 / 29

Simplex Method. Results of the simplex method. Simplex Method. Results of the simplex method.

Simplex Method. Simplex Method.


Results of the simplex method. Results of the simplex method.

When solving LP problems, the simplex method can lead to the following results: Problem has 1 basic optimal solution:
• problem has optimal solution: Optimality test is fulfilled. In the index row there are all non-basic ∆j 6= 0.
• 1 basic optimal solution,
• 1 basic optimal solution and ∞ non-basic optimal solutions, 1 1 0 0 0 −M
• 2 (or more) basic optimal solutions and ∞ non-basic optimal solutions, ~T
C basis = ~b x1 x2 x3 x4 x5 x6
B
• problem has no finite optimal solution, 1 x2 = 6 0 1 0 1/2 −1/2 0
• problem has no feasible solution. 0 x3 = 4 0 0 1 1/2 −1/2 −1
1 x1 = 3 1 0 0 −1/4 3/4 0
step 3 zmax = 9 0 0 0 1/4 1/4 M

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 15 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 16 / 29
Simplex Method. Results of the simplex method. Simplex Method. Results of the simplex method.

Simplex Method. Simplex Method.


Results of the simplex method. Results of the simplex method.

Problem has 2 (or more) BOS and ∞ N-BOS: Problem has 1 basic optimal solution and ∞ non-basic optimal solutions:
Optimality test is fulfilled. In the index row there is non-basic ∆j = 0. Optimality test is fulfilled. In the index row there is non-basic ∆j = 0, but the pivot row can not be
identified because in the pivot column k there are all αi,k ≤ 0.
−2 1 0 0 0 −M −M
~T
C basis = ~b x1 x2 x3 x4 x5 x6 x7 −2 3 0 0 0 −M −M
B
~T
C basis = ~b x1 x2 x3 x4 x5 x6 x7
1 x2 = 4 0 1 0 −1/2 1/2 0 1/2 B
−2 x1 = 5 1 0 0 −3/4 1/4 0 3/4 3 x2 = 4 0 1 0 −1/2 1/2 0 1/2
0 x3 = 2 0 0 1 −1/2 1/2 −1 1/2 −2 x1 = 5 1 0 0 −3/4 1/4 0 3/4
step 3 zmax = −6 0 0 0 1 0 M M −1 0 x3 = 2 0 0 1 0 1/2 −1 1/2
step 3 zmax = 2 0 0 0 0 1 M M

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 17 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 18 / 29

Simplex Method. Results of the simplex method. Simplex Method. Results of the simplex method.

Simplex Method. Simplex Method.


Results of the simplex method. Results of the simplex method.

Problem has no finite optimal solution: Problem has no feasible solution:


Optimality test is not fulfilled, but the pivot row can not be identified because in the pivot column k Optimality test is fulfilled, in the basis remained artificial variable with a positive value.
there are all αi,k ≤ 0.
−2 1 0 0 −M
1 1 0 0 0 −M −M ~T
C basis = ~b x1 x2 x3 x4 x5
B
~T
C basis = ~b x1 x2 x3 x4 x5 x6 x7 1 x2 = 2 0 1 1 0 0
B
1 x2 = 4 0 1 0 −1/2 1/2 0 1/2 −M x5 = 2 −1 0 −2 −1 1
1 x1 = 5 1 0 0 −3/4 1/4 0 3/4 step 1 zmax = −2M + 2 M +2 0 2M + 1 M 0
0 x3 = 2 0 0 1 −1/2 1/2 −1 1/2
step 3 zmax = 9 0 0 0 −5/4 3/4 M M + 5/4

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 19 / 29 Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 20 / 29
Simplex Method. Results of the simplex method.

Simplex Method.
Example 4.1 – Simplex Method.

Example 4.1 – using the Simplex Method find the optimal solution of following example:
zmax = 2x1 − 7x2 + 3x3
x1 + x2 ≤ 8
2x1 + 4x2 − x3 ≥ 6
2x1 − 2x2 + x3 = 8
x1 , x2 , x3 ≥ 0

Pavel Kolman (FBE Mendelu) Economic Mathematical Methods 4. Simplex Method. October 20, 2016 21 / 29
Examples to practice 4. Examples to practice 4.

Simplex Method.
Example 4.2

Example 4.2 – solve LP problem below using the simplex method:


Examples to practice 4. zmax = 2x1 + 3x2
3x1 + 3x2 ≤ 2100
x1 + 2x2 ≤ 1000
Pavel Kolman x1 , x2 ≥ 0

Department of Statistics and Operation Analysis


FBE Mendelu

October 20, 2016

Pavel Kolman (FBE Mendelu) Examples to practice 4. October 20, 2016 22 / 29 Pavel Kolman (FBE Mendelu) Examples to practice 4. October 20, 2016 23 / 29

Examples to practice 4.

Simplex Method.
Example 4.3

Example 4.3 – solve LP problem below using the simplex method:


zmin = 5x1 + 5x2
x1 + x2 = 10
3x1 + 5x2 ≥ 40
2x1 + 3x2 ≤ 33
x1 , x2 ≥ 0

Pavel Kolman (FBE Mendelu) Examples to practice 4. October 20, 2016 24 / 29

You might also like