4. Simplex Algorithm
4. Simplex Algorithm
• Subject to,
– X1 + X2 + X3 ≤ 100
– 5.X1 + 6.X2 + 5.X3 ≤ 400
– X1, X2, X3 ≥ 0
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 1
Simplex Algorithm
It’s not that simple!!
Home work
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 3
Definitions
• A set of values of the decision variables X1, X2, …, Xn that satisfies the
constraints of the LPP is called its solution. Solution of a LPP may not
satisfy the non-negativity constraints.
• A solution of a LPP which satisfies the non-negativity constraints is called
its feasible solution.
• A feasible solution which optimizes (maximizes or minimizes) the
objective function of the LPP is called Optimal Solution.
• Any solution of a system of m linear equations with n variables (m < n),
which is obtained by solving m variables keeping remaining n – m
variables zero is called a basic solution.
• The m variables whose solutions are obtained are called basic variables.
And the remaining n – m variables are called non-basic variables.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 4
Definitions
• A basic solution whose basic variables are non-negative is called basic
feasible solution.
• A basic feasible solution whose none of the basic variables is zero is
called Non-degenerate basic feasible solution.
• A basic feasible solution whose one or more basic variables is/are zero
is called Degenerate basic feasible solution.
• If the value of the objective function can be increased or decreased
indefinitely, then such solutions are called Unbounded solutions.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 5
Canonical Form of LPP
• The objective function has to be of maximization type.
– How to convert minimization model to standard form?
• Min Z = - Max (- Z)
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 6
Handling Unrestricted Variables
• Suppose in a LPP, one or more variables are unrestricted as in below
example – Revised Model
Max Z = 5.X1 + 4. X2’ –
Max Z = 5.X1 + 4.X2 4.X2’’
subject to,
subject to,
6.X1 + 4.X2 ≤ 24 6.X1 + 4. X2’ – 4.X2’’
X1 + 2.X2 ≤ 6 ≤ 24
X1 ≥ 0, X2 unrestricted X1 + 2. X2’ – 2.X2’’ ≤
6
• How can we make such decision variablesX1, X2’,non-negative?
X2’’ ≥ 0
• We can replace X2 as (X2’ - X2’’) such that X2’, X2’’ ≥ 0
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 7
Standard Form of LPP
• The objective function has to be of maximization type.
• All the constraints, except the non-negativity ones, have to be expressed as
equation.
– How to convert a upper bound constraint (≤) in to equation?
• E.g. 6.X1 + 4.X2 ≤ 24
– We can define some non-negative variable s1 such that s1 = 24 - 6.X1 - 4.X2
– Therefore, now we can write 6.X1 + 4.X2 + s1 = 24
– The non-negative variable used to convert an upper bound inequality constraints
in to equation is called a slack variable. [variable which represents the lack]
– Slack variables are represented by small s.
– How to convert a lower bound constraint (≥) in to equation?
– Subtract a non-negative Surplus variable from the LHS to turn the inequality in
to equation.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 8
Standard Form of LPP
– E.g. 6.X1 + 4.X2 ≥ 24 => 6.X1 + 4.X2 - S1 = 24
– Surplus variables are represented by capital S.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 9
The Simplex Method
• Algebraic method of solving LP.
• LP has to be in standard form.
• Start with a basic feasible solution, generally from origin, and iterate
through the corner points that only improves the objective function.
• We will not iterate through all the corner points, only the ones that
improves objective function.
• Once we are considering a point, we check if it is corresponds to the
optimal solution. If yes, we stop iteration.
• If not then we decide an entering variable through optimality
condition and a leaving variable using the feasibility condition.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 10
Example : Product Mix Problem
• The LP model of the problem is –
Maximize Z = 6.X + 5.Y
subject to, X+Y≤5
3.X + 2.Y ≤ 12
X, Y ≥ 0
• Step 1 : Convert LP model into standard form.
– Maximize Z = 6.X + 5.Y + 0.s1 + 0.s2
subject to, X + Y + s1 = 5
3.X + 2.Y + s2 = 12
X, Y, s1, s2 ≥ 0
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 11
Standard Model
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 12
Example : Product Mix Problem
• Step 3: Check if optimal solution has been arrived
– Calculate values for Zj as j
– Calculate Zj – Cj.
Cj 6 5 0 0
Solutio
CBi Basic
X Y s1 s2 n
χ
Variables 0
i 0 s1 χ 1 0 1 1 0 5
0 s
Z2j 3
0 2
0 0
0 1
0 12
0
+
Zj – Cj -6 -5 0 0
Cj 6 5 0 0
Solutio
CBi Basic
X Y s1 s2 n
Variables
0 s1 1 1 1 0 5
0 s2 3 2 0 1 12
Zj 0 0 0 0 0
Zj – Cj -6 -5 0 0
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 14
Example : Product Mix Problem Feasibility
Condition
• Step 5 : Determining leaving variable.
– Find out the ratio between solution column with pivot column.
– The basic variable associated with the smallest non-negative ratio (with
strictly positive denominator) irrespective of max or min problem is the
leaving variable.
– Corresponding row is called pivot (key) row. And, the intersection is called
pivot (key) element. Ties are broken arbitrarily.
Cj 6 5 0 0
Solutio Ratio
CBi Basic
X Y s1 s2 n
Variables 5/1 = 5
0 s1 1 1 1 0 5 12/3 = 4
0 s2 3 2 0 1 12
Zj 0 0 0 0 0 Pivot
Element
Zj – Cj -6 -5 0 0
15
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025
Gauss-Jordan
row
Example : Product Mix Problem operations
16
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025
(1 1 1 0 5)
– 1 X( 1 2/3 0 1/3 4)
Example : Product Mix Problem ( 0 1/3 1 -1/3 1)
Cj 6 5 0 0
Solutio
CBi Basic Ratio
X Y s1 s2 n
Variables
0 s1 1 1 1 0 5 5/1 = 5
0 s2 3 2 0 1 12 12/3 =
4
Zj 0 0 0 0 0
Iteration 1
Zj – Cj -6 -5 0 0
0 s1 0
? 1/3
? 1
? -1/3
? 1
?
6 X 3/3 = 2/3 0 1/3 12/3 =
1 4
Go to Step 3
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 17
LP in standard
form.
• Subject to,
– X1 + X2 + X3 ≤ 100
– 5.X1 + 6.X2 + 5.X3 ≤ 400
– X1, X2, X3 ≥ 0
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 20
Iteration :
Cj
CBi Basic Solution Ratio
Variables
Iteration :
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 21
Example : Reddy Mikks Company
• The Model was –
• Subject to,
– 6.X1 + 4.X2 ≤ 24
– X1 + 2.X2 ≤ 6
– X2 – X 1 ≤ 1
– X2 ≤ 2
– X1, X2 ≥ 0
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 22
Iteration :
Cj
CBi Basic Solution Ratio
Variables
Iteration :
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 23
Summary
• Various terms like basic solution, basic feasible solution, degenerate
and non-degenerate basic feasible solution etc.
• Representing a LPP in Canonical and Standard form.
• Solving a LPP using Simplex method. Steps involved
– Converting a LPP in standard form
– Finding initial basic feasible solution
– Checking whether the solution is optimal. If yes stop, else continue next
step.
– Determining the entering variable (pivot column)
– Determining the leaving variable (pivot row)
– Perform Gauss-Jordan row operations and reiterate from third step.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 24
Thank You!
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 25