Introduction to the simplex method
Table of Contents
We’ll start by explaining the “easy case” of the Simplex Method: when you start with a linear program in standard form where all the right-hand sides of the constraints are non-negative.
Roughly speaking, you turn the LP into a dictionary1, and then repeatedly pivot to get new dictionaries until at some point the numbers in the dictionary indicate you are done. We’ll illustrate the procedure with the following example:
Maximize
subject to
Slack variables
The first step will be to introduce slack variables, one for each of the constraints (except the positivity constraints). These are simply the difference between the right-hand side and the left-hand side of a constraint. For example, for the first constraint we define a slack variable
Introducing these slack variables leads to a linear program equivalent to the original one2 but for which all constraints are either equations or positivity constraints:
Maximize
subject to
Dictionaries
Solving for the slack variables we get the initial dictionary for our problem:
The variables on the left,
Each dictionary is a system of equations that is equivalent to the equality constraints from the LP obtained from the original LP by adding slack variables. In terms of dictionaries, the LP we want to solve is equivalent to “maximize
The solution associated to a dictionary
To any dictionary there is an associated solution of the system of equations: just set all the non-basic variables to zero and compute the values of the basic variables from the dictionary. For the above dictionary the associated solution is
Feasibility
The solution associated to a dictionary certainly satisfies all of the constraints that are equations, but may fail to satisfy the positivity constraints. When it does also satisfy the positivity constraints it is said to be a feasible solution and the dictionary is called feasible too.
Here the initial dictionary is feasible because the LP we started with happened to have all the right-hand sides of constraints non-negative. This needn’t always happen and later on we will cover what to do when some constraints have negative right-hand sides; but for now, let’s focus on the case when the initial dictionary is feasible, like in this example.
Pivoting
The main idea of the Simplex Method is to go from dictionary to dictionary by exchanging a basic variable for a non-basic one, in such a way that:
- The objective function increases at each step3.
- The dictionary is feasible at every step.
Let’s explain how to pick the variables you swap.
Picking a non-basic variable to enter the basis
In the dictionary we have, the
So, to increase
Either one would be a valid choice and make some progress toward solving the LP, but we’ll use a definite rule to pick one:
Standard rule4 for picking the entering variable: among the non-basic variables that have a positive coefficient in the objective function, choose the one with the largest coefficient. If more than one variable is tied for largest coefficient, pick the one with smallest index (e.g., if both
This is not done for mathematical reasons but for logistical reasons! By having a standard rule for the course, I can make sure that when you solve an LP you don’t get crazy numbers, and the course grader has an easier time, too.
Picking a basic variable to exit the basis
We’ve settled on putting
We see that:
- To keep
, we can only increase up to . - To keep
, we can only increase up to . - To keep
, we can only increase up to .
So, to keep all variables non-negative, we can only go up to
In case two variable are tied for strictest bound on the entering variable we need a tie breaking rule:
Standard rule for picking the exiting variable: In case of ties, pick the variable with the smallest index.
Performing the pivot
So we’ve decided that
- Solving for
in the equation for . - Plugging that value for
into the equations for the other basic variables and the equation for the objective function.
This gives us:
This is a new dictionary that still represents the same LP. The associated solution has
One way to tell you made a mistake
The solution turned out feasible again by virtue of the way we picked the exiting variable. If we had, for example, decided to make
The associated solution has
When to stop pivoting
At this point you know how to pivot to increase the objective function while keeping the dictionary feasible. For example, in the last feasible dictionary we can pivot by having
This new dictionary has all of the coefficients in the
Why exactly is
There’s no need to worry, that can’t happen and the dictionary tells us why: we have
Additionally we learn that
There is an alternative way of presenting the Simplex Method using tableaux instead of dictionaries. This really just a different way of writing the same calculation. If you’ve studied linear programming before you are likely to have seen tableaux. It’s a good exercise to solve the same LP both ways, so you can see how this dictionary method corresponds to the tableau. If you don’t know about tableaux, don’t worry about them.
Notice that this equivalent LP is not in standard form.
Or, at least, doesn’t decrease. Sometimes you are forced to make degenerate pivots which don’t change the associated solution or the value of the objective function.
In some course materials you might see this standard rule called “Anstee’s rule” instead, named tongue in cheek after Richard Anstee who has taught this course many times. Don’t expect non-UBC people to call it Anstee’s rule
No comments:
Post a Comment