This is a continuation of Linear Programming as it uses the same problem statement.

Simplex algorithm is a method of solving linear programming problems, it is a polynomial time algorithm that doesn’t evaluate infeasible solutions and explores progressively better solutions, telling you when the optima has been reached and stops, tells you when the optima has been reached and stops.

There are two forms:

  1. Algebraic form of simplex: this will give you the insights of what it really is doing
  2. Tabular (or tableau) form of simplex: this will allow you to crank-turn rather easily and implement a program

Simplex: Algebraic Form

The goal is to maximise the objective function subjected to the constraints and where .

What simplex is doing is finding a connected path from a starting corner to another corner, in a way such that you will always increase the objective function from one corner to another. Effectively jumping one vertex to another vertex of the convex polyhedron.

Start by choosing and as non-basic variables (i.e., variables that are set to zero.). This gives the solutions to and as and respectively. This only works if the RHS is non-negative.

Note that its not always true that fixing a decision variable is will be in the feasible region. But there are ways of to get a feasible start point. In our case, we are assuming canonical form, where the RHS is non-negative, so it always ensures that when decision variables are set to 0, it will be at a corner point in the feasible region.

Now to find a connected path from one vertex to another in a systematic way where your growing the objective function

Note that fixing the decision variables leads to the point on the graph, from this point we can only jump to or . We want to choose a jump such that we have the steepest increase in the objective. In this way, its a greedy algorithm that at every position, we find a point of jump so that the my objective function of all the choices I have locally gives me the steepest increase in the objective.

First Iteration

First, for a better visual understanding, rewrite the constraints making the basic variables and the subjects each with coefficient of . This isn’t required but helps with visualisation.

And the objective function is simply:

Recall, currently and . Therefore the objective function, substituting these values, is .

There are two ways to increase in this case, by increasing the value of x or y. Note in simplex, we can only improve one variable at a time

Additionally to increase the objective function, if the coefficient of the variable in the objective function is positive, you increase the variable. Else, if its coefficient is negative you decrease the variable.

Between the two variables, choose the one that gives the steepest increase. In this case, As , for each unit is increased, is increased by ( ratio) whereas and have a ratio.

Thus we choose to increase (since it has a larger coefficient of the two choices, hence gives higher increase of the objective).

To increase , we want to increase it, and convert it to a basic variable, to do that or have to be turned into non basic (fixed) variables. To do that:

  • Start from and for equation and
  • We want to be a non basic variable, thus we need , as is fixed, the only thing we can do is increase to
  • We do the same for :

This allows the increase to be such that the constraints are still satisfied. In this case, it can be increased from either:

  1. to according to the first constraint. Anything more will violate the non-negativity constraint for the slack variable s.
  2. to according to the second constraint. Anything more will violate the non-negativity constraint for t.

Choosing the minimum of and will ensure that both

By choosing the minimum increase , enters the basis, whilst exists it. The new set of non-basic variables are and , and the basic variable are and ,

Second Iteration

First rewrite the constraints in making the new basic variables and the subjects:

  • The first constraint would be , but we want to be a subject, not a term in the formula
  • The second constraingt would be
  • Use the second constraint to replace in the first

This results in constraints:

The objective function is still in terms of the basic variable , so substitute so that it is in terms of the non-basic variables:

Notice how the objective function is growing as previously with and as the non-basic variables, and now when and are the non-basic variables

Now here, there is are two ways to increase , which is by increasing or decreasing . However, cannot be decreased because currently and slack variables must be greater than or equal to . So if we decrease we result in an infeasible solution.

So we can only increase . To do this, we are turning into a basic variable, this means one of the basic variable or must be turned into non-basic:

First of all, we know as its a non-basic variable

To make or non-basic, we want it to equal

  1. for
  2. for

This allows the increase to be such that the constraints are still satisfied. In this case, it can be increased from either:

  1. —> according to the first constraint. Anything more will violate the non-negativity constraint of .
  2. —> according to the second constraint. Anything more will violate the non-negativity constraint of .

Choosing the minimum of and will ensure that both

Thus by choosing —> , enters the basis and becomes a basic variable and exists it and becomes non-basic.

  • The set of non-basic (fixed) variables are and
  • The set of basic (free) variables are and

Third Iteration

Again, rewrite the constraints so that they are in terms of the non-basic (fixed) variables, and the basic (free) variables are the subjects

  • The first constraint needs to be rewritten so is the subject
  • The second constraint already has a basic variable as a subject (), but it also has one in the body (), we can substitute from the first constraint to get:

The objective function is still in terms of basic variables, so substiting results in:

From the previous iteration, has increased from to (recall , ).

However, to increase it further, and have to be decreased, as they are already , this cannot be done without violating the non-negativity constraints.

As both these choices are infeasible, the algorithm stops.

When simplex method stops, the values of the basic variables are:

  • and

Therefore, the optimum values of the decision variables are

When simplex method stopped, the values of basic variables were x = 2 and y = 3 (we get these by substituting s = 0 and t = 0 (non-basic variables) into the constraints in the previous slide.

Simplex: Tableau Form

The Tableau form of Simplex follows the same process, but in a more convenient tabular fashion, enabling the process to be converted into a computer program.

First convert the problem into slack form, the objective function and constraints go from:

&\begin{cases} z = 6x + 5y \\ x + y \leq 5 \\ 3x + 2y \leq 12 \\ x, y \geq 0 \end{cases} \quad \Rightarrow \quad \begin{cases} z = 6x + 5y + 0s + 0t \\ x + y + s = 5 \\ 3x + 2y + t = 12 \\ x, y, s, t \geq 0 \end{cases} \end{aligned}$$

First, create a table where the second row contains each variable from the objective function as a column, and the first row lists the corresponding objective function coefficients

Then list the basic (free) variables and their coefficient in the objective function, recalling that the slack variables are always initially in the basis, i.e. the non-basics variables are and .

Write down the coefficients on the LHS of the constraints and the RHS of the constraints (add an additional column for the RHS). This effectively describes the equations of and in a tabular form.

Note columns s to make

1 0 0 1

this is what is meant by in basis

First Iteration

A new variable is defined for each column as the dot product of two vectors: the coefficients of the basic variables in the objective function, and the corresponding coefficients at column in the constraint rows. That is,

Where is the coefficient of the -th basic variable in the objective function, and is the coefficient of column in row of the constraint matrix.

Step 1: Express The Objective Function In Terms Of Non-Basic Variables

The new row represents the coefficients of the variables in the objective function when expressed in terms of the non-basic variables, indicating its net contribution to the objective function.

The RHS column has no , so it simply stores . It represents the current value of the objective function when and are non-basic variables (e.g., , ).

Algebraically, this reflects the initial expression of the objective function in terms of non-basic variables: . Just as the algebraic form, the first iteration results in no change in the function nor its value.

Step 2: Select The Largest Contributing Non-Basic Variable To Enter The Basis

Choose to increase the non-basic variable with the largest positive coefficient in the objective function row to get the maximal objective function increase.

Here, the largest is in column , so enters the basis.

Step 3: Select The Leaving Variable

To determine which basic variable leaves the basis, divide each RHS value by the corresponding positive entry in the entering column. This gives the values.

The row with the smallest positive indicates the leaving variable, ensuring constraints are enforced and feasibility is maintained.

Therefore, leaves the basis and enters it, resulting in the basic variables and , and the non-basic variables and .

Second Iteration

Step 1: Express The Objective Function In Terms Of Non-Basic Variables

Now we need to rewrite our constraint so that they are in terms of our non-basic variables, this is done by rewriting it so that the coefficient of the variable entering the bases () is .

This can be done by dividing each column of the variable leaving the basis () with the intersection between the variable entering the basis and the one leaving.

This can be done by dividing each column at by the column at row , i.e. dividing by the intersection between and .

Note the coefficient of and were written to the left.

Similarly, the constraint must be expressed in terms of the new non-basic variables . This can be done by substituting in our expression at row for the new basic variable in row .

This is done by performing some row operation on the previous row with the row such that the basic variable at is and is , i.e. has been substituted and is has a one coefficient.

Here it is for each column

Note that this is equivalent to rewriting the constraint as:

Through this, you can see the importance of ensuring the basic variable coefficient are and the how substitution leads to having a coefficient.

Now to express the objective function in terms of the non-basis variables calculate

This is equivalent to , where as and are the non-basic variables (, ), the objective function is equal to and is increasing.

Step 2: Select The Largest Contributing Non-Basic Variable To Enter The Basis

To increase the objective function further, the only option we have is to increase , this means enters the basis.

Step 3: Select The Leaving Variable

Compute the maximum value θ that y can be increased to based on each constraint, and choose the minimum of such values in order to satisfy both constraints.

Recall this is calculated by dividing each basic rows RHS by the corresponding value at column .

The minimum variable is at row , so that would be leaving the basis.

Third Iteration

Step 1: Express The Objective Function In Terms Of Non-Basic Variables

Now enters the basis and leaves it. The new pair of basic variables are and non-basic variables are . Create two new rows for the basic variables and rewrite them in terms of the non-basic variables.

As enters the basis, write that one first, calculate each column by first finding the intersection of the entering and exiting variables which is at row column = , and write the equation of by dividing the whole leaving row () by

Note that we always write the row of the variable entering the basis first, this is because we need it to substitute into the row staying in the basis to get that in terms of the new non-basic variabels (substitute in row )

So do that, subsittue in row by doing row operations on row and such that has its basic variables of the form

0 1 1 0

i.e. at row column and column

Here,

Finally, we express the objective function (z = 6x + 5y) in terms of (s,t) and we can see that the objective function cannot be increased further without violating our constraints and so we stop.

The constraints algebraically are equivalent to:

And the objective function to

The maximal value for is the final RHS