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

4. Simplex Algorithm

The document discusses the limitations of solving linear programming problems with more than two variables using the graphical method and introduces the Simplex Algorithm as an algebraic method for solving linear programming problems in standard form. It defines key terms such as feasible solutions, optimal solutions, and the role of basic and non-basic variables. The document also outlines the steps involved in the Simplex Method, including determining entering and leaving variables, and performing Gauss-Jordan operations to find optimal solutions.

Uploaded by

bengali Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

4. Simplex Algorithm

The document discusses the limitations of solving linear programming problems with more than two variables using the graphical method and introduces the Simplex Algorithm as an algebraic method for solving linear programming problems in standard form. It defines key terms such as feasible solutions, optimal solutions, and the role of basic and non-basic variables. The document also outlines the steps involved in the Simplex Method, including determining entering and leaving variables, and performing Gauss-Jordan operations to find optimal solutions.

Uploaded by

bengali Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPSX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Do it Now!

• Solve the ‘Farming Vegetables’ problem using Graphical Method.


• The model was –

• Maximize Z = 1850.X1 + 2080.X2 + 1875.X3

• Subject to,
– X1 + X2 + X3 ≤ 100
– 5.X1 + 6.X2 + 5.X3 ≤ 400
– X1, X2, X3 ≥ 0

• Cannot solve using graphical method as more than two variables.

Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 1
Simplex Algorithm
It’s not that simple!!
Home work

Find out why it is called


‘Simplex’?

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)

• All the constraints has to be of inequality type.


– What will happen if a constraints is of equation type?
• E.g. 6.X1 + 4.X2 = 24
– We can represent it using two weak inequalities as –
• 6.X1 + 4.X2 ≤ 24
• 6.X1 + 4.X2 ≥ 24

• All the decision variables has to be non-negative.


– What if a decision variable is unrestricted?

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

• Replace X2 everywhere in the model.

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.

• All the variables has to be non-negative.


• Right hand side of each constraints has to be non-negative.
– In case the R.H.S is negative, multiply both side with -1 to make it positive

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

Example : Product Mix ProblemMax


0.s
Z = 6.X + 5.Y + 0.s 1 +
2

• Step 2 : Find out a basic feasible solution. subject to, X + Y + s1


= 5
– Now, we have 4 variables (n) and 2 equations (m).
3.X + 2.Y +
– Now we can set (n-m) variables to 0 to find out the basic solution of rest m
s2 = 12
variables. Co-efficient of
Co-efficient of X, Y, s1, s2
Objective
– We willBasic
makeVariables
X = Y = 0, since we want to start from≥origin.
0
Funtion
– This gives us basic solution of s1 = 5 and s2 = 12.
– Since, both the basic variables are non-negative, this is a basic feasible
solution Cj 6 5 0 0
Solutio
CBi Basic
X Y s1 s2 n
Variables
0 s1 1 1 1 0 5

Initial Simplex Table


0 s2 3 2 0 1 12

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

– If all of the Zj – Cj ≥ 0 (≤ 0 for minimization problem), then the solution is


optimal solution. Otherwise, find the entering variable and leaving variable
to reiterate the step.
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025 13
Optimality
Example : Product Mix Problem Condition

• Step 4 : Determining entering variable.


– The non-basic variable associated with the most negative (most positive for
minimization problem) coefficient in Zj – Cj is entering variable.
– Corresponding column is called the pivot column or key column.
– Ties are broken arbitrarily.

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

• Step 6 : Replacing leaving variable with entering one.


1. For Pivot Row:
a) Replace the leaving variable in the ‘Basic Variables’ column with the entering
variable and update the CBi column accordingly.
b) New pivot row = Current pivot row / pivot element
2. For All other rows of Basic Variables:
• New row = (Current row) – (pivot column coefficient) x (New pivot row)

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.

• Step 2 : Find out a


basic feasible
Example : Product Mix Problem solution.

Iteration 0 • Step 3 : Check if


optimal solution
Cj 6 5 0 0
Solutio has been arrived.
CBi Basic Ratio If yes, stop. Else,
X Y s1 s2 n
Variables Step 4.
0 s1 1 1 1 0 5 5/1 = 5
• Step 4 :
0 s2 3 2 0 1 12 12/3 = Determine the
4 entering variable
Zj 0 0 0 0 0
Iteration 1 • Step 5 : Determine
Zj – Cj -6 -5 0 0
0 s1 0 1/3 1 -1/3 1 1/ the leaving
(1/3)=3 variable
6 X 3/3 = 2/3 0 1/3 12/3 =
1 4 4/
Zj 0+6 0+4 0+0 0+2 0+24=2 • Step 6 : Perform
(2/3)=6
=6 =4 =0 =2 4 Gauss – Jordan row
Zj – Cj 6- 4-5=- 0- 2-
6=0 1 0=0 0=2 operaions and goto
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025
step 3. 18
LP in standard
form.

• Step 2 : Find out a


basic feasible
Example : Product Mix Problem solution.

Iteration 1 • Step 3 : Check if


optimal solution
Cj 6 5 0 0
Solutio has been arrived.
CBi Basic Ratio If yes, stop. Else,
X Y s1 s2 n
Variables Step 4.
0 s1 0 1/3 1 -1/3 1 1/
(1/3)=3 • Step 4 :
Determine the
6 X 3/3 = 2/3 0 1/3 12/3 = 4/
entering variable
1 4 (2/3)=6
Zj 0+6 Iteration
0+4 2
0+0 0+2 0+24=2 • Step 5 : Determine
5 Y =6
0 =4
1 =0
3 =2
-1 34 the leaving
6 Zj X
– Cj 6- 4-5=- 0- 0- variable
1 0 -2 1 2
6=0 1 0=0 2=0
Zj 6 5 3 1 27 • Step 6 : Perform
Zj – Cj 0 0 3 1 => Optimal Gauss – Jordan row
Solution operaions and goto
Preetam K Sur, Assistant Professor, Computer Science & Engineering Department, GCETTS 05/04/2025
step 3. 19
Example : Farming Vegetables
• The model was –

• Maximize Z = 1850.X1 + 2080.X2 + 1875.X3

• 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 –

• Maximize Z = 5.X1 + 4.X2

• 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

You might also like