01 Simplex Method
01 Simplex Method
IN TRANSPORTATION
THE SIMPLEX METHOD
2
Introduction of Simplex method
Dr. Árpád Török, Gábor Pauer
Steps of solving a linear programming model using the Simplex
method:
a. Standard form
b. Introducing slack variables/surplus variables
c. Creating the table (+check optimality)
d. Pivot variables
e. Creating a new table
f. Checking for optimality
g. Identify optimal values
Advantages of the method:
•Simple to solve problems
•The solution of LPP of more than two variables can be
easily obtained
3
Linear Programming Problems (LPPs)
Dr. Árpád Török, Gábor Pauer
Two forms:
Ad1, General Linear Programming Problems (GLPPs)
conversion (4 steps)
4
Ad1, General Linear Programming Problem -GLPP
Dr. Árpád Török, Gábor Pauer
Maximize / Minimize:
Z = c1x1 + c2x2 + c3x3 +……..+ cnxn
Subject to constraints:
a11x1 + a12x2 + …..........+a1nxn (≤ or ≥) b1
a21x1 + a22x2 + ………..+a2nxn (≤ or ≥) b2
….
5
Conversion of GLPP to standard form (SLPP)- 4 steps
Dr. Árpád Török, Gábor Pauer
6
Conversion of GLPP to standard form (SLPP)- 4 steps
Dr. Árpád Török, Gábor Pauer
7
Conversion of GLPP to standard form (SLPP)- Examples
Dr. Árpád Török, Gábor Pauer
Step 1- Objective function should be in maximization form
Step 2- Convert all inequalities as equations
Step 3- The right side of constraints should be non-negative
Step 4- All variables should be non-negative
GLPP: SLPP:
Minimize Z = 3x1 + x2 Maximize -Z = -3x1 - x2
Subject to Subject to
2x1 + x2 ≤ 2 2x1 + x2 + s1 = 2
3x1 + 4x2 ≥ 12 3x1 + 4x2 –s2 = 12
and x1 ≥ 0, x2 ≥ 0 and x1 ≥ 0, x2 ≥ 0, s1 ≥ 0, s2 ≥ 0
8
Conversion of GLPP to standard form (SLPP)- Examples
Dr. Árpád Török, Gábor Pauer
Step 1- Objective function should be in maximization form
Step 2- Convert all inequalities as equations
Step 3- The right side of constraints should be non-negative
Step 4- All variables should be non-negative
EXAMPLE 2: PART-SOLUTION
SOLUTION OF EXAMPLE OF EXAMPLE 2: 2:
GLPP: (after
SLPP: Step 3)
Minimize Z = x1 + 2x2 + 3x3 SLPP:
Maximize -Z = – x1 – 2x2 – 3(x3’-x3’’)
Subject to Maximize
Subject to-Z = – x1 – 2x2 – 3x3
2x1 + 3x2 + 3x3 ≥ – 4 Subject to
–2x1 – 3x2 – 3(x3’-x3’’) + s1= 4
3x1 + 5x2 + 2x3 ≤ 7 –2x1 – 3x2 – 3x3 + s1= 4
3x1 + 5x2 + 2(x3’-x3’’) + s2 = 7
and x1, x2 ≥ 0, and 3x1 + 5x2 + 2x3 + s2 = 7
and x1 ≥ 0, x2 ≥ 0, x’3 ≥ 0,
x3 is unrestricted in sign and
x’’3 x≥10,
≥ 0,
s1 x≥20,≥ s0,2 ≥s10≥ 0, s2 ≥ 0,
x3 is unrestricted in sign
9
Conversion of GLPP to standard form (SLPP)- Examples
Dr. Árpád Török, Gábor Pauer
Step 1- Objective function should be in maximization form
Step 2- Convert all inequalities as equations
Step 3- The right side of constraints should be non-negative
Step 4- All variables should be non-negative
10
Conversion of GLPP to standard form (SLPP)- Examples
Dr. Árpád Török, Gábor Pauer
11
Basic definitions
Solution of LPP Dr. Árpád Török, Gábor Pauer
Any set of variable (x1, x2… xn), which satisfies the given constraint is called solution of LPP.
Basic solution
Is a solution obtained by setting any ‘n’ variable equal to zero and solving remaining ‘m’
variables. Such ‘m’ variables are called Basic variables and ‘n’ variables are called Non-basic
variables.
Basic feasible solution
A basic solution that is feasible (all basic variables are nonnegative) is called basic feasible
solution. There are two types of basic feasible solution.
•Degenerate basic feasible solution: If any of the basic variable of a basic feasible
solution is zero than it is said to be degenerate basic feasible solution.
•Non-degenerate basic feasible solution: It is a basic feasible solution which has exactly
‘m’ positive xi, where i=1, 2,…m. In other words all ‘m’ basic variables are positive and
remaining ‘n’ variables are zero.
Optimum basic feasible solution
A basic feasible solution is said to be optimum if it optimizes (max / min) the objective
function.
12
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
a. Standard form
Minimize -z = -8x1 - 10x2 -7x3 b. Introducing
slack/surplus variables
Subject to c. Creating the table
(+check optimality)
x1 + 3x2 + 2x3 ≤ 10 d. Pivot variables
e. Creating a new table
-x1 - 5x2 - x3 ≥ -8 f. Checking for optimality
g. Identify optimal values
and x1, x2 , x3 ≥ 0
13
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
a. Standard form
Step a,b – Standard form+Introducing b. Introducing
slack/surplus variables slack/surplus variables
c. Creating the table
= the 4 steps of converting the GLPP to SLPP! (+check optimality)
d. Pivot variables
e. Creating a new table
f. Checking for optimality
g. Identify optimal values
14
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step c – Creating the table a. Standard form
•coefficients corresponding to the linear constraint b. Introducing
variables slack/surplus variables
•coefficients of the objective function (multiplied by c. Creating the table
(-1); in the column of ‘z’: we use 1 in case of max(z), (+check optimality)
and use -1 in case of max(-z)!) d. Pivot variables
e. Creating a new table
Maximize f. Checking for optimality
z = 8x1 + 10x2 +7x3 g. Identify optimal values
Subject to
x1 + 3x2 + 2x3 + s1 = 10
x1 + 5x2 + x3 + s2 = 8
and x1, x2 , x3,
s 1, s 2 ≥ 0
15
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step c – (+check optimality) a. Standard form
•Optimal solution: the values assigned to the b. Introducing
variables in the objective function to give the slack/surplus variables
c. Creating the table
largest zeta value (+check optimality)
•Check optimality using the table: all values d. Pivot variables
e. Creating a new table
in the last row must contain values greater f. Checking for optimality
than or equal to zero g. Identify optimal values
Smallest
Smallest neg.
non-negative 17
value
indicator
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step e – Creating the new table a. Standard form
I. To optimize the pivot variable, it will need to be b. Introducing
transformed into a unit value (value of 1) slack/surplus variables
c. Creating the table
II. The other values in the column containing the
(+check optimality)
unit value have to become zero d. Pivot variables
III. During this, the table have to be kept e. Creating a new table
equivalent f. Checking for optimality
g. Identify optimal values
18
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step e – Creating the new table
I. To optimize the pivot variable, it will need to be transformed into a unit value (value of 1)
II. The other values in the column containing the unit value have to become zero
III. During this, the table have to be kept equivalent
New tableau value = (Negative value in old tableau pivot column) x (value in new
tableau pivot row) + (Old tableau value)
19
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step e – Creating the new table
New tableau value = (Negative value in old tableau pivot column) x (value in new
tableau pivot row) + (Old tableau value)
20
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step e – Creating the new table
New tableau value = (Negative value in old tableau pivot column) x (value in new
tableau pivot row) + (Old tableau value)
2= (+10) * (1/5) + 0
21
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step f – Checking for optimality a. Standard form
•Check optimality using the table: all values b. Introducing
in the last row must contain values greater slack/surplus variables
c. Creating the table
than or equal to zero (+check optimality)
d. Pivot variables
e. Creating a new table
f. Checking for optimality
g. Identify optimal values
Smallest
non-negative
Smallest neg.
indicator
value
23
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step e (again) – Creating the new table
I. To optimize the pivot variable, it will need to be transformed into a unit value (value of 1)
II. The other values in the column containing the unit value have to become zero
III. During this, the table have to be kept equivalent
New tableau value = (Negative value in old tableau pivot column) x (value in new
tableau pivot row) + (Old tableau value)
OPTIMALITY REACHED
25
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step g – Identifying optimal values a. Standard form
•Basic variable: have a single 1 value in its b. Introducing
column and the rest are zeros; the row that slack/surplus variables
c. Creating the table
contains the 1 value will correspond to the (+check optimality)
beta value. The beta value will represent the d. Pivot variables
optimal solution for the given variable e. Creating a new table
f. Checking for optimality
•Non-basic variable: the remaining variables; g. Identify optimal values
the optimal solution of the non-basic
variables is zero
26
Solving a linear programming model using the Simplex
method
Dr. Árpád Török, Gábor Pauer
Step g – Identifying optimal values a. Standard form
•Basic variables b. Introducing
•Non-basic variables slack/surplus variables
c. Creating the table
(+check optimality)
d. Pivot variables
e. Creating a new table
f. Checking for optimality
g. Identify optimal values
Original task: Solution:
Maximize z = 8x1 + 10x2 +7x3 Max(z) = 64
Subject to Subject to
x1 + 3x2 + 2x3 + s1 = 10 x1 = 8 s1= 2
x1 + 5x2 + x3 + s2 = 8 x2 = 0 s2= 0
and x1, x2 , x3, s1, s2 ≥ 0 x3 = 0
27
Example 2- Solving a linear programming model
using the Simplex method
Dr. Árpád Török, Gábor Pauer
a. Standard form
Maximize Z = 3x1 + 2x2 b. Introducing
slack/surplus variables
Subject to c. Creating the table
(+check optimality)
x1 + x 2 ≤ 4 d. Pivot variables
e. Creating a new table
x1 - x2 ≤ 2 f. Checking for optimality
g. Identify optimal values
and x1, x2 ≥ 0
28
Example 2- Solving a linear programming model
using the Simplex method
Dr. Árpád Török, Gábor Pauer
a. Standard form
Step a,b – Standard form+Introducing b. Introducing
slack/surplus variables slack/surplus variables
c. Creating the table
(+check optimality)
d. Pivot variables
e. Creating a new table
f. Checking for optimality
g. Identify optimal values
Maximize Z = 3x1 + 2x2 Maximize Z = 3x1 + 2x2
Subject to Subject to
x1 + x 2 ≤ 4 x1 + x 2 + s 1 = 4
x1 - x2 ≤ 2 x1 - x2 + s2= 2
and x1, x2 ≥ 0 and x1, x2, s1, s2 ≥ 0
29
Example 2- Solving a linear programming model using the
Simplex method
Dr. Árpád Török, Gábor Pauer
Step c – Creating the table (+check optimality) a. Standard form
b. Introducing
slack/surplus variables
Maximize Z = 3x1 + 2x2 c. Creating the table
Subject to (+check optimality)
d. Pivot variables
x1 + x2 + s1 = 4 e. Creating a new table
f. Checking for optimality
x1 - x2 + s2= 2 g. Identify optimal values
and
x1, x2, s1, s2 ≥ 0 x1 x2 s1 s2 Z b
1 1 1 0 0 4
1 -1 0 1 0 2
-3 -2 0 0 1 0
Not optimal yet
30
Example 2- Solving a linear programming model
using the Simplex method
Dr. Árpád Török, Gábor Pauer
Step d – Pivot variables a. Standard form
Identifying pivot variable using the table: in the column b. Introducing
slack/surplus variables
of the smallest negative value in bottom row; in the row
c. Creating the table
of the smallest non-negative indicator (indicator: divide (+check optimality)
the beta values of the linear constraints by their d. Pivot variables
corresponding values from the column containing the e. Creating a new table
possible pivot variable) f. Checking for optimality
g. Identify optimal values
x1 x2 s1 s2 Z b Indicator
1 1 1 0 0 4 4/1=4
1 -1 0 1 0 2 2/1=2 Smallest non-negat. indicator
-3 -2 0 0 1 0
Smallest
neg.
value
31
Example 2- Solving a linear programming model using the
Simplex method
Dr. Árpád Török, Gábor Pauer
Step e – Creating the new table
I. To optimize the pivot variable, it will need to be transformed into a unit value (value of 1)
II. The other values in the column containing the unit value have to become zero
III. During this, the table have to be kept equivalent
New tableau value = (Negative value in old tableau pivot column) x (value in new
tableau pivot row) + (Old tableau value)
x1 x2 s1 s2 Z b
1 1 1 0 0 4
The old table:
1 -1 0 1 0 2
-3 -2 0 0 1 0
Old pivot column
x1 x2 s1 s2 Z b
The new 0 2 1 -1 0 2
table: New
1 -1 0 1 0 2
pivot row
32
0 -5 0 3 1 6
Example 2- Solving a linear programming model using the
Simplex method
Dr. Tobor Sipos, Anteneh Afework
Step f – Checking for optimality a. Standard form
•Check optimality using the table: all values b. Introducing
in the last row must contain values greater slack/surplus variables
c. Creating the table
than or equal to zero (+check optimality)
d. Pivot variables
e. Creating a new table
f. Checking for optimality
g. Identify optimal values
x1 x2 s1 s2 Z b
0 2 1 -1 0 2
1 -1 0 1 0 2
0 -5 0 3 1 6
x1 x2 s1 s2 Z b Indicator
0 2 1 -1 0 2 2/2=1Smallest non-negat.
indicator
1 -1 0 1 0 2 2/(-1)= -2 (neglect if negative!!)
0 -5 0 3 1 6
Smallest
neg.
value 34
Example 2- Solving a linear programming model using the
Simplex method
Dr. Árpád Török, Gábor Pauer
Step e (again) – Creating the new table + Step f (again) – Checking for optimality
I. To optimize the pivot variable, it will need to be transformed into a unit value (value of 1)
II. The other values in the column containing the unit value have to become zero
III. During this, the table have to be kept equivalent
New tableau value = (Negative value in old tableau pivot column) x (value in new
tableau pivot row) + (Old tableau value)
x1 x2 s1 s2 Z b
0 2 1 -1 0 2
The old table:
1 -1 0 1 0 2
0 -5 0 3 1 6
37
Example 2- Solving a linear programming model
using the MATLAB software
Dr. Árpád Török, Gábor Pauer
Tutorial:
https://www.mathworks.com/help/optim/
ug/linprog.html?requestedDomain=www.
mathworks.com#zmw57dd0e65600
Syntax:
x= linprog(f,A,b,Aeq,beq,lb,ub)
Finds the minimum of a problem, taking the
constraints and bounds into account.
Where:
f: coefficient vector, represents the objective function;
A, b: linear inequality constraints (encodes A*x <= b); Set A=[] and b=[] if no inequ. exists.
Aeq, beq: linear equality constraints (encodes Aeq*x=beq); Aeq=[] and beq=[] if no equ. exists
lb: lower bounds of x (encodes x(i) >= lb(i) for all i);
38
ub: upper bounds of x (encodes x(i) =< ub(i) for all i).
Example 2- Solving a linear programming model
using the MATLAB software
Dr. Árpád Török, Gábor Pauer
In MATLAB, we need the problem in minimization form, and the
constraining inequalities in ≤ form!
39
Example 3- Solve the following LPP!
Dr. Árpád Török, Gábor Pauer
Solution:
Pivot variable: 1st row 2nd column (value 1)
Basic variables: x2, s2, s3, Z
Non-basic variables: x1, s1
Final solution: x1=0; x2=4; Z=28
41
BUDAPEST UNIVERSITY OF
TECHNOLOGY AND ECONOMICS
Dr. Tibor SIPOS Ph.D.
Anteneh Afework
Zsombor SZABÓ
2019
email: [email protected]