Simplex Algorithm - Slack Variables & Initial Tableau (Edexcel A Level Further Maths: Decision Maths 1)

Revision Note

Test yourself
Paul

Author

Paul

Last updated

Introduction to the Simplex Algorithm

What is the simplex algorithm?

  • The simplex algorithm is an alternative to the graphical method for solving linear programming problems
    • It is particularly useful when there are more than 2 decision variables as these cannot be drawn graphically (Not very easily at least!)
    • Essentially the simplex algorithm works by considering each vertex of the basic feasible region in turn until an optimal solution is found
  • Initially the simplex algorithm can only be applied to an LP problem that has a basic feasible solution
    • For problems where the basic feasible region contains the origin, the basic feasible solution is the origin
      • In practical situations though, this is often not realistic
        • For example, the number of chairs and tables made by a furniture manufacturer trying to maximise their profit
        • if they make no chairs and no tables, they won't make any profit!
        • but the origin would satisfy all constraints if it is in the feasible region 
    • For problems where the basic feasible region does not contain the origin the algorithm is adapted such that a basic feasible solution is found first
      • then the simplex algorithm can be applied as usual

Slack Variables

What are slack variables?

  • In the first instance, the simplex algorithm deals with constraints (inequalities) involving (excluding the non-negativity constraints)
    • Slack variables are used to turn inequalities involving  into equations
  • A slack variable, as the name implies, takes up the spare (slack) that a function falls short on in "less than or equal to" constraints
    • A slack variable will be added to (the left hand side of) each constraint so will be non-negative
  • The number of slack variables required in a problem will be the same as the number of (non-negativity) constraints involving

Worked example

The following linear programming problem is to be solved using the simplex algorithm.

Maximise

P equals 8 x plus 5 y plus 7 z

subject to

2 x plus 3 y less or equal than 10
x plus 2 y plus 5 z less or equal than 60
5 y plus 3 z less or equal than 40
x comma space y comma space z greater or equal than 0

Use slack variables to write the constraints (except the non-negativity constraint) of the linear programming problem as equations.

 

Use s subscript 1 to 'use up the slack' in the inequality 2 x plus 3 y less or equal than 10

2 x plus 3 y plus s subscript 1 equals 10

use s subscript 2 for x plus 2 y plus 5 z less or equal than 60

x plus 2 y plus 5 x plus s subscript 2 equals 60

and s subscript 3 for 5 y plus 3 z less or equal than 40

5 y plus 3 z plus s subscript 3 equals 40

The constraints as equations using slack variables are
table attributes columnalign right center left columnspacing 0px end attributes row cell bold 2 bold italic x bold plus bold 3 bold italic y bold plus bold italic s subscript bold 1 end cell bold equals bold 10 row cell bold italic x bold plus bold 2 bold italic y bold plus bold 5 bold italic x bold plus bold italic s subscript bold 2 end cell bold equals bold 60 row cell bold 5 bold italic y bold plus bold 3 bold italic z bold plus bold italic s subscript bold 3 end cell bold equals bold 40 end table

Initial Tableau

What is the initial tableau?

  • The simplex algorithm is performed by creating a series of matrices, or tables, showing the values of each decision variable, each slack variable and the objective function until an optimal solution is found
  • The first of these tables is called the initial tableau
  • To set up the initial tableau, the equations derived from the inequalities (constraints) are needed along with a rearrangement of the objective function such that zero is on one side
    • e.g. P equals 8 x plus 5 y plus 7 z becomes P minus 8 x minus 5 y minus 7 z equals 0
  • The initial tableau is created by
    • columns represent the basic variable (b.v.), the decision variables (x comma space y comma space z), the slack variables open parentheses s subscript 1 comma space s subscript 2 comma space s subscript 3 close parentheses and the value (the RHS of each equation)
    • rows are completed with the coefficients of each equation/constraint
      • the last row is the (rearranged) objective function
    • the basic variable column is completed last
      • the basic variable for each row is the variable that has a 1 in that row but 0's in all other rows of that column
      • the last row is always the objective row
e.g.
Constructing the initial tableau for the objective function

P minus 8 x minus 5 y minus 7 z equals 0

and equations (constraints)

table row cell 2 x plus 3 y plus s subscript 1 end cell equals 10 row cell x plus 2 y plus 5 x plus s subscript 2 end cell equals 60 row cell 5 y plus 3 z plus s subscript 3 end cell equals 40 end table

x~6afLSG_initial-tableau

Simplex Algorithm

How do I apply the simplex algorithm?

  • Once the initial tableau is set up the first iteration can begin

  • STEP 1
    For each row (except the objective row), find the bold italic theta-value by dividing the 'Value' by the entry in the pivot column
    • Deduce the pivot column by looking for the most negative entry in the objective row (excluding 'Value')

  • STEP 2
    Find the pivot element (often just called the pivot) by finding where the pivot column and pivot row meet
    • Deduce the pivot row by selecting the row with the least positive bold italic theta-value

  • STEP 3
    Use a series of row operations to update the tableau
    • manipulate the pivot row so that the pivot element is 1
    • for each 'old row' (i.e. each row from the previous tableau) use a multiple of the 'new pivot row' to make each entry in the pivot column zero, including the objective row

  • STEP 4
    Complete the updated tableau by completing the header column of basic variables (b.v.)
    • to do this look for the column with one 1 and all other entries 0

Worked example

The initial tableau for using the simplex algorithm is given below.  Apply the first iteration of the simplex algorithm.

b.v. x y z s subscript 1 s subscript 2 s subscript 3 Value
s subscript 1 2 3 0 1 0 0 10
s subscript 2 1 2 5 0 1 0 60
s subscript 3 0 5 3 0 0 1 40
P -8 -5 -7 0 0 0 0

  • STEP 1
    The most negative entry in the objective row is -8, so column 1 (C1) is the pivot column
    The theta-values for each row are

R1:  theta subscript 1 equals 10 divided by 2 equals 5
R2:  theta subscript 2 equals 60 divided by 1 equals 60
R3:   - n/a since division by zero is undefined

  • STEP 2
    The least positive theta-value is theta subscript 1 equals 5 so the pivot row is row 1 (R1)
    The pivot element is R1C1

Pivot is 2

  • STEP 3
    Use the row operation 0.5 apostrophe straight R 1 apostrophe to make the pivot element 1
    (The apostrophes indicate 'old row 1' - i.e. the row from the previous tableau.)
    For every other row use a row operation that makes the entry in the pivot column 0

    (e.g.  the objective row (R4) will be 'old row 4 plus 8 lots of new row 1' (apostrophe straight R 4 apostrophe plus 8 straight R 1))

  • STEP 4
    Complete the b.v. column by l
    ooking for a column with one 1 and all others 0
b.v. x y z s subscript 1 s subscript 2 s subscript 3 Value Row Op.
bold italic x 1 1.5 0 0.5 0 0 5 0.5 apostrophe straight R 1 apostrophe
bold italic s subscript bold 2 0 0.5 5 -0.5 1 0 55 apostrophe straight R 2 apostrophe minus straight R 1
bold italic s subscript bold 3 0 5 3 0 0 1 40 apostrophe straight R 3 apostrophe
P 0 7 -7 4 0 0 40 apostrophe straight R 4 apostrophe plus 8 straight R 1

How do I know when the simplex algorithm is complete?

  • The simplex algorithm is compete when there are no negative entries in the objective row (excluding 'Value')
    • This tableau is called the final tableau
    • The optimal solution can be found from the final tableau

How do I find the optimal solution from the final tableau?

  • The basic variable (b.v.) and value column indicate the optimal solution
    • The variables in the basic value column take the value in their value column
    • The objective function will then have a maximum value of the entry in its value column
    • All other variables are non-basic and take the value of 0, regardless of values in the table

Worked example

Apply one more iteration of the simplex algorithm to the tableau below and hence find the optimal solution to the linear programming problem it represents.

b.v. x y z s subscript 1 s subscript 2 s subscript 3 Value
x 1 1.5 0 0.5 0 0 5
s subscript 2 0 0.5 5 -0.5 1 0 55
s subscript 3 0 5 3 0 0 1 40
P 0 7 -7 4 0 0 40

First find the pivot column; -7 in C3 is the most negative entry in the objective row

Find the theta-values for each row

table row cell theta subscript 1 space end cell equals cell space straight n divided by straight a end cell row cell theta subscript 2 end cell equals cell 55 divided by 5 equals 11 end cell row cell theta subscript 3 end cell equals cell 40 divided by 3 equals 13.333... end cell end table

11 is the least positive so the pivot is 5 (R2C3)

Use row operations to make the pivot 1 and other entries in its column 0
Complete the b.v. column

b.v. x y z s subscript 1 s subscript 2 s subscript 3 Value Row Op.
x 1 1.5 0 0.5 0 0 5 apostrophe straight R 1 apostrophe
s subscript 2 0 0.1 1 -0.1 0.2 0 11 0.2 apostrophe straight R 2 apostrophe
s subscript 3 0 4.7 0 0.3 -0.6 1 7 apostrophe straight R 3 apostrophe minus 3 straight R 2
P 0 7.7 0 3.3 1.4 0 117 apostrophe straight R 4 apostrophe plus 7 straight R 2

There are no negative entries in the objective row so the algorithm is complete and the optimal solution can be read from the final tableau

Basic variables (in header column) take the values from their 'Value' column
Non-basic variable take the value zero
The maximum value of the objective function is the 'Value' in its row

bold italic x bold equals bold 5 bold comma bold space bold italic z bold equals bold 11 bold comma bold space bold italic s subscript bold 3 bold equals bold 7
bold italic y bold equals bold 0 bold comma bold space bold italic s subscript bold 1 bold equals bold 0 bold comma bold space bold italic s subscript bold 2 bold equals bold 0

bold italic P has a maximum value of 117

You've read 0 of your 5 free revision notes this week

Sign up now. It’s free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Paul

Author: Paul

Expertise: Maths

Paul has taught mathematics for 20 years and has been an examiner for Edexcel for over a decade. GCSE, A level, pure, mechanics, statistics, discrete – if it’s in a Maths exam, Paul will know about it. Paul is a passionate fan of clear and colourful notes with fascinating diagrams – one of the many reasons he is excited to be a member of the SME team.