Skip to content

Revised Simplex step-by-step

Published:

LP definition with bounds

Let’s start by defining a linear programming problem in canonical form:

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.

Note

Depending on the source, it seems as if the definitions for “canonical form” and “standard form” of an LP problem vary. Here, we use the most convent for our purposes, but be aware that often they are described as

  • Generic: min{cTxblAxbu,lxu}\min\{c^T x \mid b_l \leq Ax \leq b_u, l \leq x \leq u\}
  • Canonical: min{cTxAxb,x0}\min\{c^T x \mid Ax \leq b, x \geq 0\}
  • Standard: min{cTxAx=b,x0}\min\{c^T x \mid Ax = b, x \geq 0\}

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_{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 of BB 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_{N} \in \R^{m \times (n - m)} is the matrix formed by the non-basic columns of AA.

Note

Let’s consider an example with 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 solution (BS) as a solution where the basic variables are determined by solving the system BxB+NxN=bBx_B + Nx_N = b while the non-basic variables are usually set to their bounds or to 00, if unbounded. To be considered a basic feasible solution (BFS), the solution must also satisfy the bounds lxul \leq x \leq u. This corresponds to the following assignments:

[BN0Inm][xBxN]=[bvN]\begin{bmatrix} B & N \\ 0 & I_{n - m} \end{bmatrix} \begin{bmatrix} x_B \\ x_N \end{bmatrix} = \begin{bmatrix} b \\ v_N \end{bmatrix}

where vNRnmv_N \in \R^{n - m} is vector containing an arbitrary combination of lower and upper bounds 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

Error analysis

When operating with floating-point arithmetic, numerical errors can accumulate and affect the accuracy of the solution. We now analyse the sources of errors in the Revised Simplex Method and how they impact the solution.

Linear system

An exact solution to a linear system Ax=bAx = b satisfies the equation precisely, while a computed solution (A+E)x~=b(A + E)\tilde{x} = b solves a perturbed system, where EE represents the error we are introducing due to numerical inaccuracies. We are interested in the Δx=x~x\Delta x = \tilde{x} - x, which represents the difference between the exact solution xx and the computed solution.

Δx=x~x=A1(Ax~b)=A1(Ax~(A+E)x~)=A1Ex~\Delta x = \tilde{x} - x = A^{-1}(A \tilde{x} - b) = A^{-1} (A \tilde{x} - (A + E) \tilde{x}) = - A^{-1} E \tilde{x}

We are interested in the norm of the error Δx\|\Delta x\|:

Δx=A1Ex~A1Ex~\|\Delta x\| = \|A^{-1} E \tilde{x}\| \leq \|A^{-1}\| \|E\| \|\tilde{x}\|

Using the definition of the condition number κ(A)=AA1\kappa(A) = \|A\| \|A^{-1}\|, we can rewrite the above expression as:

Δxx~κ(A)EA\frac{\|\Delta x\|}{\|\tilde{x}\|} \leq \kappa(A) \frac{\|E\|}{\|A\|}

More precisely, we are interested in the residual r=Ax~br = A \tilde{x} - b, which quantifies how well the computed solution satisfies the original system, or the relative residual rBx~\frac{\|r\|}{\|B\|\|\tilde{x}\|}. We can also bound the residual norm as follows:

r=Ax~b=Ex~Ex~\|r\| = \|A \tilde{x} - b\| = \|E \tilde{x}\| \leq \|E\| \|\tilde{x}\|

therefore, the relative residual can be bounded as:

rAx~EA\frac{\|r\|}{\|A\| \|\tilde{x}\|} \leq \frac{\|E\|}{\|A\|}

Some notable results tell us that

  • EAdmϵ\frac{\|E\|}{\|A\|} \leq dm\epsilon, where mm is the number of rows, and ϵ\epsilon is the machine precision.
  • Ei,j3.01dmϵ|E_{i,j}| \leq 3.01 dm\epsilon
  • ϵ1016\epsilon \approx 10^{-16} for IEEE double precision.

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 δe\delta_e be the change in value we want to apply to the entering variable xex_e, which is currently outside the basis. To keep the system satisfied, we need to adjust the basic variables xˉB\bar{x}_B as follows: BxˉB+A:,eδe+NxN=b B \bar{x}_B + A_{:,e} \delta_e + N x_N = b \newline From which we get: xˉB=B1(bNxN)B1A:,eδe=xBB1A:,eδe=xBdδe \begin{align*} \bar{x}_B &= B^{-1} (b - N x_N) - B^{-1}A_{:,e} \delta_e \newline &= x_B - B^{-1} A_{:,e} \delta_e \newline &= x_B - d \delta_e \end{align*}
    • While we would like to increase (or decrease) xex_e indefinitely to improve the objective function, we must ensure that xˉB\bar{x}_B and xex_e itself remain within their respective bounds. {lBxˉB=xBdδeuBxeleδeuexe \begin{cases} l_B \leq \bar{x}_B = x_B - d \delta_e \leq u_B \newline x_e - l_e \leq \delta_e \leq u_e - x_e \newline \end{cases} with the first condition which expands to: {xBiuBidiδexBilBidiif di>0xBilBidiδexBiuBidiif di<0<δe<+if di=0 \begin{cases} \frac{x_{B_i} - u_{B_i}}{d_i} \leq \delta_e \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 \delta_e \leq \frac{x_{B_i} - u_{B_i}}{d_i} & \text{if } d_i < 0 \newline -\infty < \delta_e < +\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 δe\delta_e^* 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) δe\delta_e to δe\delta_e^*.
  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=xe+δexB=xBdδe \begin{align*} x_e & = x_e + \delta_e^* \newline x_B & = x_B - d \delta_e^* \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\}.