Skip to content

Revised Simplex step-by-step

Published:

LP definition with bounds

Let’s start by defining a linear programming problem in standard form with bounds:

Min cTxSubject to Ax=blxu\begin{align*} \text{Min } & c^T x \\ \text{Subject to } & Ax = b \\ & l \leq x \leq u \end{align*}

where:

  • ARm×nA \in \R^{m \times n} is the constraint matrix.
  • bRmb \in \R^m is the right-hand side vector.
  • cRnc \in \R^n is the coefficient vector of the objective function.
  • l,u(R{,+})nl, u \in (\R \cup \{-\infty, +\infty\})^n are the lower and upper bounds on the variables.

A feasible solution to this problem is a vector xRnx \in \R^n that satisfies all the constraints. A feasible solution is optimal if it minimizes the objective function while satisfying the constraints.

Basis

A basis B\mathcal{B} is a set of mm indices corresponding to a subset of columns of AA. We define as BABRm×mB \coloneqq A_{\mathcal{B}} \in \R^{m \times m}, and we assume that BB is invertible. If AA is full rank, then there exists at least one such basis. Each column corresponds to a basic variable.
The remaining nmn - m variables are called non-basic variables, and the corresponding indices belong to the set N\mathcal{N}, where NANRm×(nm)N \coloneqq A_{\mathcal{N}} \in \R^{m \times (n - m)} is the matrix formed by the non-basic columns of AA.

Example
Let B={1,3}\mathcal{B} = \{1, 3\} and N={2,4,5}\mathcal{N} = \{2, 4, 5\}. Then, for the following problem we have:

A=[13210701510],B=[13105],N=[207110]A = \begin{bmatrix} 13 & 2 & 1 & 0 & 7 \\ 0 & 1 & 5 & 1 & 0 \\ \end{bmatrix}, \quad B = \begin{bmatrix} 13 & 1 \\ 0 & 5 \end{bmatrix}, \quad N = \begin{bmatrix} 2 & 0 & 7 \\ 1 & 1 & 0 \end{bmatrix}

Following the partition of variables into basic and non-basic, we can follow a similar approach for the vectors cc, bb and xx:

c=[cBcN],b=[bBbN],x=[xBxN]c = \begin{bmatrix} c_B \\ c_N \end{bmatrix}, \quad b = \begin{bmatrix} b_B \\ b_N \end{bmatrix}, \quad x = \begin{bmatrix} x_B \\ x_N \end{bmatrix}

Basic Feasible Solution

Given a basis B\mathcal{B}, we can define a basic feasible solution (BFS) as a solution where the basic variables are determined by solving the system BxB+NxN=bBx_B + Nx_N = b. Usually the non-basic variables are set to their bounds or to 00, if unbounded. Moreover, for the solution to be optimal, we are interested in the following assignments for the non-basic variables:

Variable TypeValue in BFS
Basic VariablesxB=B1(bNxN)x_B = B^{-1} (b - N x_N), lixiuil_i \leq x_i \leq u_i
Bounded Non-Basic VariablesSet to x=lix = l_i or xi=uix_i = u_i
Unbounded Non-Basic VariablesSet to 00

Revised Simplex Method Overview

The Revised Simplex Method is an efficient algorithm for solving linear programming problems. It operates by iteratively improving a basic feasible solution until an optimal solution is found.

Step 1: Initialization

  1. Choose an initial basis B\mathcal{B} such that the corresponding basic feasible solution is feasible.
  2. Compute π=(BT)1cB\pi = (B^T)^{-1} c_B, where cBc_B are the coefficients of the basic variables in the objective function.
  3. Compute the reduced costs for the non-basic variables: rN=cNNTπr_N = c_N - N^T \pi.
    • We first express the basic variables in terms of the non-basic ones: BxB+NxN=bxB=B1(bNxN) \begin{align*} Bx_B + Nx_N & = b \newline x_B & = B^{-1} (b - N x_N) \newline \end{align*}
    • Then, we consider the objective function: cTx=cBTxB+cNTxN=cBTB1(bNxN)+cNTxN=cBTB1b+(cNTcBTB1N)Reduced CostsxN \begin{align*} c^T x & = c_B^T x_B + c_N^T x_N \newline & = c_B^T B^{-1} (b - N x_N) + c_N^T x_N \newline & = c_B^T B^{-1} b + \underbrace{(c_N^T - c_B^T B^{-1} N)}_{\text{Reduced Costs}} x_N \newline \end{align*}
    • We define the reduced costs vector as: rN=cNNTBTcB r_N = c_N - N^T B^{-T} c_B Altering the reduced costs vector rr will affect the objective function value, e.g., increasing a non-basic variable with a negative reduced cost will decrease the objective function value, moving us closer to the optimum.
  4. If ri0r_i \ge 0 for all non-basic variables already at their lower bound and ri0r_i \le 0 for all non-basic variables already at their upper bound, then the current solution is optimal. Stop.
  5. If there is a non-basic variable with a reduced cost that violates the optimality condition, select one such variable to enter the basis. This is called the entering variable.
  6. Compute the direction of movement for the basic variables: d=B1A:,e d = B^{-1} A_{:,e} where A:,eA_{:,e} is the column of AA corresponding to the entering variable
    • Let tt be the new value we want to assign to the entering variable. To keep the system satisfied, we need to adjust the basic variables xˉB\bar{x}_B as follows: BxˉB+A:,et+NxN=b B \bar{x}_B + A_{:,e} t + N x_N = b \newline From which we get: xˉB=B1(bNxN)B1A:,et=xBB1A:,et=xBdt \begin{align*} \bar{x}_B &= B^{-1} (b - N x_N) - B^{-1}A_{:,e} t \newline &= x_B - B^{-1} A_{:,e} t \newline &= x_B - d t \end{align*}
    • While we would like to increase (or decrease) tt indefinitely to improve the objective function, we must ensure that xˉB\bar{x}_B and tt itself remain within their respective bounds. {lBxˉB=xBdtuBletue \begin{cases} l_B \leq \bar{x}_B = x_B - d t \leq u_B \newline l_e \leq t \leq u_e \newline \end{cases} with the first condition leading to: {xBiuBiditxBilBidiif di>0xBilBiditxBiuBidiif di<0<t<+if di=0 \begin{cases} \frac{x_{B_i} - u_{B_i}}{d_i} \leq t \leq \frac{x_{B_i} - l_{B_i}}{d_i} & \text{if } d_i > 0 \newline \frac{x_{B_i} - l_{B_i}}{d_i} \leq t \leq \frac{x_{B_i} - u_{B_i}}{d_i} & \text{if } d_i < 0 \newline -\infty < t < +\infty & \text{if } d_i = 0 \end{cases}
    • In practice, we only care about the strictest bound that limit the increase (or decrease) of tt.
  7. Determine the maximum allowable step size tt^* for the entering variable without violating any bounds. If no such limit exists (i.e., the entering variable is unbounded in the direction of improvement), then the problem is unbounded. Stop.
  8. Identify the leaving variable, with index ll, which is the basic variable that reaches its bound first as we increase (or decrease) tt to tt^*.
  9. Update the basis by replacing the leaving variable with the entering variable.
    • Note that, based on how we made the change, the leaving variable will now be at its bound (either lower or upper).
  10. Update the basic feasible solution accordingly: xe=txB=xBdt \begin{align*} x_e & = t^* \newline x_B & = x_B - d t^* \newline \end{align*} and do the same for the sets B=(B{l}){e}\mathcal{B} = (\mathcal{B} \setminus \{l\}) \cup \{e\} and N=(N{e}){l}\mathcal{N} = (\mathcal{N} \setminus \{e\}) \cup \{l\}.