IB Optimisation

Convexity open_in_new

Definition (convex set) open_in_new

A set $S\subseteq \R^n$ is said to be convex if for every $\v x,\v y\in S$ and $\lambda\in[0,1]$, $$ \begin{align*} \lambda \v x + (1-\lambda) \v y \in S. \end{align*} $$

This means $S$ contains all points on the line segment joined by two points in $S$.

Definition (convex function) open_in_new

A function $f: S\to\R$ is said to be convex if

  • $S$ is convex; and

  • for all $\v x,\v y\in S$ and $\lambda\in(0,1)$, $$ \begin{align*} f\big(\lambda \v x + (1-\lambda)\v y\big) \leq \lambda f(\v x) + (1-\lambda) f(\v y). \tag{*} \end{align*} $$

This means the graph is always under the secant line between two points.

$f$ said to be strictly convex if strict inequality holds in (*).

Notation (definite matrix) open_in_new

An $n\times n$ matrix $A$ is said to be positive semidefinite, denoted as $A\succeq 0$, if $\v x^T A\v x \geq 0$ for all $x\in\R^n$.

We write $A\succeq B$ to mean $A-B\succeq 0$, and $A\preceq B$ to mean $B-A\succeq 0$.

Definition (Hessian) open_in_new

For a twice differentiable function $f:\R^n \to \R$, the Hessian $\nabla^2 f(x)$ is defined to be an $n\times n$ matrix with entrices $$ \begin{align*} \big[\nabla^2 f(x)\big]_{ij} = \frac{\partial^2 f(x)}{\partial x_i x_j}. \end{align*} $$

Theorem (first-order condition of convex functions) open_in_new

A differentiable function $f: \R^n \to \R$ is convex iff for all $\v x,\v y\in\R^n$, $$ \begin{align*} f(\v y) \geq f(\v x) + \nabla f(x)^T (\v y-\v x) \end{align*} $$

Proof

Note that if $\nabla f(x_0) = \v 0$ for some $\v x_0$, then $f(\v y) \geq f(\v x_0)$ for all $\v y$ so $\v x_0$ is a local minimum.

Theorem (convex function iff increasing directional gradient) open_in_new

A differentiable function $f: \R^n \to \R$ is convex iff for all $\v x,\v y\in\R^n$, $$ \begin{align*} (\v y-\v x) \cdot (\nabla f(\v y) - \nabla f(\v x)) \geq 0. \end{align*} $$

Proof

Theorem (second-order condition of convex functions) open_in_new

A twice differentiable function $f: \R^n \to \R$ is convex iff $\nabla^2 f(\v x)$ $\succeq 0$ for all $\v x\in\R^n$.

Proof for sufficiency

Gradient descent open_in_new

Let $f: \R^n \to \R$ be convex.

Problem

$$ \begin{align*} \text{Minimise } & f(\v x) \\ \text{over } & \v x\in\R^n. \end{align*} $$

A local minimum is a global minimum. The idea is to take steps along $-\nabla f(x)$ direction. Then roughly $$ \begin{align*} f(x - \epsilon\nabla f(x)) \approx f(x) - \epsilon |\nabla f(x)|^2 < f(x). \end{align*} $$

Gradient descent algorithm open_in_new
  1. For $t=0$, start from an initial point $x_0$.

  2. Repeat until some criterion is satisfied: at some $t$,

    1. Choose a descent direction $\v v_t$ such that $\nabla f(x_t)^T \v v_t < 0$.

    2. Choose a step size $\epsilon_t$.

    3. Update $x_{t+1} = x_t + \epsilon_t v_t$.

Smoothness and strong convexity in gradient descent open_in_new

Definition (smoothness, strongly convexity) open_in_new

Let $f: \R^n \to \R$ be twice differentiable and $\alpha,\beta>0$.

  • $f$ is said to be $\alpha$-strongly convex if $\nabla^2 f(x)$ $\succeq$ $\alpha I$ for all $x\in\R^n$.

  • $f$ is said to be $\beta$-smooth if $\nabla^2 f(x)$ $\preceq$ $\beta I$ for all $x\in\R^n$.

A $\alpha$-strongly convex function cannot change too slowly, and a $\beta$-smooth function cannot change too quickly. This is illustrated in the following theorem:

Theorem (bounds on smooth and strongly convex functions) open_in_new

Let $\v x,\v y\in\R^n$. If $f$ is $\beta$-smooth, then $$ \begin{align*} f(\v y) \leq f(\v x) + \nabla f(\v x)^T (\v y - \v x) + \frac{\beta}{2}|\v x-\v y|^2. \end{align*} $$ If $f$ is $\alpha$-strongly convex, then $$ \begin{align*} f(\v y) \geq f(\v x) + \nabla f(\v x)^T (\v y - \v x) + \frac{\alpha}{2}|\v x - \v y|^2. \end{align*} $$

Proof

Corollary (gradient descent step of smooth function) open_in_new

If $f$ is $\beta$-smooth, then $$ \begin{align*} f\Big(\v x - \frac{1}{\beta}\nabla f(\v x)\Big) \leq f(\v x) - \frac{1}{2\beta}|\nabla f(\v x)|^2 \end{align*} $$

Proof: plug in $\v y = \v x - \frac{1}{\beta}\nabla f(\v x)$ to the previous theorem.

This shows that we are guaranteed to reduce the objective function value going from $\v x$ to $\v x - \frac{1}{\beta} \nabla f(\v x)$, e.g. we do not overshoot.

Theorem (lower bound for minimum value in strongly convex functions) open_in_new

Let $f$ be $\alpha$-strongly convex. Let $p^\ast = \inf_\v x f(\v x)$ be the optimal value.

For any $\v x\in\R^n$, $$ \begin{align*} p^\ast \geq f(\v x) - \frac{1}{2\alpha} |\nabla f(\v x)|^2. \end{align*} $$

Proof

This shows that if $\nabla f(\v x)$ is close to zero (say $|\nabla f(\v x)| < \sqrt{2\alpha\epsilon}$), then $f(\v x)$ is close to optimal ($f(\v x) \leq p^\ast + \epsilon$).

Theorem (convergence of gradient descent for strongly convex and smooth functions) open_in_new

If $f$ is $\alpha$-strongly convex and $\beta$-smooth that is minimised at $x^\ast$, then the gradient descent with constant step size $1/\beta$, i.e. $$ \begin{align*} \v x_{t+1} = \v x_t - \frac{1}{\beta}\nabla f(\v x) \end{align*} $$ satisfies $$ \begin{align*} f(\v x_t) - f(x^\ast) \leq \left(1-\frac{\alpha}{\beta}\right)^t (f(\v x_0) - f(\v x^\ast)). \end{align*} $$ A more common but looser bound is $$ \begin{align*} f(\v x_t) - f(x^\ast) \leq e^{-(\alpha/\beta)t}(f(\v x_0) - f(\v x^\ast)). \end{align*} $$

Proof

To ensure $f(\v x_t) - f(\v x^\ast) \leq \epsilon$, we need $t = (\beta/\alpha)\log((f(\v x_0) - f(\v x^\ast))/\epsilon)$.

  • The relation $t\sim \log (1/\epsilon)$ is called linear convergence.

  • The ratio $\beta/\alpha > 1$ is called the condition number. The closer it is to 1, the faster the convergence.

Newton's method open_in_new

The update rule in Newton's method is $$ \begin{align*} \v x_{t+1} = \v x_t - (\nabla^2 f(\v x_t))\inv \nabla f(\v x_t) \end{align*} $$

Motivation for Newton's method open_in_new

We approximate using the second-order Taylor expansion $$ \begin{align*} f(\v y) \approx f(\v x_t) + \nabla f(\v x_t)^T (\v y - \v x_t) + \frac{1}{2} (\v y - \v x_t)^T \nabla^2 f(\v x_t) (\v y - \v x_t) \end{align*} $$ and set $\v x_{t+1}$ to minimise the right hand side $$ \begin{align*} \v x_{t+1} = \arg\min_{\v y} \left[f(\v x_t) + \nabla f(\v x_t)^T (\v y - \v x_t) + \frac{1}{2} (\v y - \v x_t)^T \nabla^2 f(\v x_t) (\v y - \v x_t)\right]. \end{align*} $$ Since the second-order approximation is convex, we set the derivative to zero: $$ \begin{align*} 0 &= \nabla f(\v x_t) + \nabla^2 f(\v x_t) (\v y - \v x_t) \\ \v y &= \v x_t - (\nabla^2 f(\v x_t))\inv \nabla f(\v x_t). \end{align*} $$

For $f: \R \to \R$, this is the same as trying to find the root of $f'$ using a linear approximation: $$ \begin{align*} x_{t+1} = x_t - \frac{f'(x_t)}{f''(x_t)}. \end{align*} $$

Definition (matrix norm) open_in_new

For some $n\times n$ real matrix $A$, denote $\|A\|$ as the smallest $a\geq 0$ such that $|A\v z| \leq a|\v z|$ for all $\v z\in\R^n$.

For positive semidefinite matrix, $\|A\|$ is the largest eigenvalue.

Theorem (convergence of gradient descent using Newton's method) open_in_new

Suppose $f$ is a twice-differentiable $\alpha$-strongly convex function for $\alpha>0$, minimised at $x^\ast$.

Suppose further that the Hessian of $f$ is $l$-Lipschitz, i.e. for all $\v x,\v y\in\R^n$, $\|\nabla^2 f(\v x) - \nabla^2 f(\v y)\| \leq l|\v x - \v y|$.

Then Newton's method satisfies $$ \begin{align*} f(x_t) - f(x^\ast) \leq \frac{2\alpha^3}{l^2}\left(\frac{l}{2\alpha^2}|\nabla f(\v x_0)|\right)^{2^{t+1}} \end{align*} $$

Proof (non-examinable)

If $\v x_0$ is close to optimal ($|\nabla f(\v x_0)| < 2\alpha^2/l$), then Newton's method is guaranteed to converge faster than exponentially fast. Otherwise it may fail to converge.

You can first do normal gradient descent, and then Newton's method when it is close enough.

Barrier method open_in_new

Let $f: \R^n\to\R$ be a convex objective function and $f_i: \R^n \to \R$ be linear for $1\leq i\leq m$, i.e. $f_i(\v x) = \v a_i^T \v x - b_i$.

Problem

$$ \begin{align*} \text{Minimise } & f(\v x) \\ \text{over } & \v x\in\R^n \\ \text{subject to } & f_i(\v x) \leq 0 \quad\text{for } 1\leq i\leq m. \end{align*} $$

We convert this to an unconstrained problem

Problem

$$ \begin{align*} \text{Minimise } & f(\v x) + \sum_{i=1}^{m} \phi(f_i(\v x)) \\ \text{over } & \v x\in\R^n. \end{align*} $$

Often we pick $\phi(x) = -\log(-x)$, the logarithmic barrier function, leading to

Problem

$$ \begin{align*} \text{Minimise } & t f(\v x) + \Phi(\v x) \\ \text{over } & \v x\in\R^n \\ \text{where } &\Phi(\v x) = -\sum_{i=1}^{m} \log(-f_i(\v x)). \end{align*} $$

$t>0$ is a parameter to trade-off the relative importance of $f$ and $\Phi$.

This is a convex optimisation problem (Derivation).

Algorithm of the barrier method open_in_new
  1. Find a feasible solution $\v x$ (i.e. satisfying $f_i(\v x)\leq 0$for all $i$) and choose some $t>0$ and $\alpha>1$.

  2. Repeat until $t$ is large enough:

    1. Compute the minimiser $x^\ast(t)$ of $tf(\v x) + \Phi(\v x)$ using Newton's method with initial point $\v x$.

    2. Update $x := x^\ast(t)$ and $t:=\alpha t$.

At each $t$ update, the problem is not changed too much, so Newton's method is expected to converge quickly.

Lagrange multiplier method open_in_new

Let $\mathcal{X}\subseteq \R^n$, $f: \mathcal{X}\to\R$, and $h: \R^n \to\R^m$.

Problem

$$ \begin{align*} \text{Minimise } & f(\v x) \\ \text{over } & \v x\in\mathcal{X} \\ \text{subject to } & h(\v x) = \v b. \end{align*} $$

We can transform this constrained optimisation problem to an unconstrained one:

Problem

$$ \begin{align*} \text{Minimise } & L(\v x, \lambda) = f(\v x) - \v \lambda^T(h(\v x) - \v b), \quad \text{the ``Lagrangian"}, \\ \text{over } &\v x\in\mathcal{X}. \\ \end{align*} $$

This gives a penalty of $-\v \lambda^T$ per unit of constraint violation.

Theorem (Lagrange sufficiency) open_in_new

Let $\v x^\ast \in \mathcal{X}$ and $\v \lambda^\ast \in\R^m$.

If $\v x^\ast$ is a minimiser of $L(\v x,\v \lambda^\ast)$ and $h(\v x^\ast) = \v b$, then $\v x^\ast$ is a minimiser of $f(\v x)$ subject to $h(\v x) = \v b$.

More precisely, let $\mathcal{X}(\v b) = \sb{\v x\in\mathcal{X}}{h(\v x) = \v b}$. If $$ \begin{align*} L(\v x^\ast, \v \lambda^\ast) = \min_{\v x\in\mathcal{X}} L(\v x, \v \lambda^\ast)\quad \text{and}\quad h(\v x^\ast) = \v b, \end{align*} $$ then $$ \begin{align*} f(\v x^\ast) = \min_{\v x\in\mathcal{X}(\v b)} f(\v x). \end{align*} $$

Proof

Note that this is just a sufficient condition, not a necessary one.

Strategy using Lagrange sufficiency theorem open_in_new

To solve

Problem

$$ \begin{align*} \text{Minimise } &f(\v x) \\ \text{over } &\v x\in\mathcal{X} \\ \text{subject to } &h(\v x) \leq \v b, \end{align*} $$

  1. Add a slack variable to change the inequality constraint to an equality:

Problem

$$ \begin{align*} \text{Minimise } &f(\v x) \\ \text{over } &\v x\in\mathcal{X}, \\ &\v s\in\R^m, \v s\geq 0 \\ \text{subject to } &h(\v x) + \v s = \v b. \end{align*} $$

  1. Set the Lagrangian $$ \begin{align*} L(\v x,\v s,\v \lambda) = f(\v x) - \v \lambda^T (h(\v x) + \v s - \v b). \end{align*} $$

  2. Find $$ \begin{align*} \Lambda = \sb{\v \lambda\in\R^m}{\inf_{\v x\in\mathcal{X},\ \v s\geq 0} L(\v x,\v s,\v \lambda) > -\infty}. \end{align*} $$

  3. For each $\v \lambda\in\Lambda$, find the minimiser $\v x^\ast(\v \lambda), \v s^\ast(\v \lambda)$, i.e. $$ \begin{align*} L(\v x^\ast(\v \lambda), \v s^\ast(\v \lambda), \v \lambda) = \inf_{x\in\mathcal{X},\ \v s\geq 0} L(\v x,\v s,\v \lambda). \end{align*} $$

  4. Find $\v \lambda^\ast$ such that $(\v x^\ast(\v \lambda^\ast), \v s^\ast(\v \lambda^\ast))$ is feasible, i.e. $\v x^\ast(\v \lambda^\ast)\in\mathcal{X}$, $\v s^\ast(\v \lambda^\ast)\geq 0$, and $h(\v x^\ast(\v \lambda)) + \v s^\ast(\v \lambda^\ast) = \v b$.

  5. By Lagrange sufficiency theorem, $\v x^\ast(\v \lambda^{\ast})$ is optimal for the original constrained problem.

Example

Theorem (complementary slackness) open_in_new

Using the notation here, let $\v \lambda\in\Lambda$ and $\v x^\ast, \v s^\ast$ such that $$ \begin{align*} L(\v x^\ast, \v s^\ast, \v \lambda) = \inf_{\v x\in\mathcal{X},\ \v s\geq 0} L(\v x,\v s,\v \lambda). \end{align*} $$

Then for any $i=1,2,\ldots,m$, $$ \begin{align*} \begin{cases} \lambda_i = 0, \\ (h(\v x^\ast))_i \leq b_i, \end{cases} \quad \text{or} \quad \begin{cases} \lambda_i < 0, \\ (h(\v x^\ast))_i = b_i. \end{cases} \end{align*} $$

Proof

Example

Duality open_in_new

Definition (dual problem) open_in_new

Let $\mathcal{X}\subseteq \R^n$, $f: \mathcal{X}\to\R$, $h: \R^n \to \R^m$, and $\v b\in\R^m$.

For a primal problem

Problem

$$ \begin{align*} \text{Minimise } &f(\v x) \\ \text{over } &\v x\in \mathcal{X} \\ \text{subject to } &h(\v x) = \v b, \end{align*} $$

let the Lagrangian $L(\v x, \v \lambda) = f(\v x) - \lambda^T (h(\v x) - \v b)$ and $\Lambda = \sb{\lambda\in\R^m}{ \min_{x\in\mathcal{X}} L(\v x,\v \lambda)>-\infty}$.

The dual objective function is defined as $$ \begin{align*} g(\v \lambda) = \min_{x\in\mathcal{X}} L(\v x,\v \lambda) \end{align*} $$ and the dual problem is defined as

Problem

$$ \begin{align*} \text{Maximise }& g(\v \lambda) \\ \text{over }& \v \lambda\in\Lambda. \end{align*} $$

$g$ is concave, i.e. $-g$ is convex. (Why?) Therefore it is generally easier to solve.

Theorem (weak duality) open_in_new

See this and this for notation.

If $\v x \in \mathcal{X}(\v b)$ and $\v \lambda\in\Lambda$, then $$ \begin{align*} f(\v x) \geq g(\v \lambda). \end{align*} $$

In particular, $$ \begin{align*} \min_{\v x\in\mathcal{X}(\v b)} f(\v x) \geq \max_{\v \lambda\in\Lambda} g(\v \lambda). \end{align*} $$

Proof

This means for any $\v x,\v \lambda$, $$ \begin{align*} f(\v x) \geq \text{Objective value } \min_{\v x\in\mathcal{X}(\v b)} f(\v x) \geq g(\v \lambda). \end{align*} $$

Definition (strong duality) open_in_new

See here for notation.

We say strong duality holds for a problem if $$ \begin{align*} \min_{\v x\in\mathcal{X}(\v b)} f(\v x) = \max_{\v \lambda\in\Lambda} g(\v \lambda). \end{align*} $$

Lagrange method works (almost) corresponds to when strong duality holds. (Why?)

Condition for strong duality open_in_new

Definition (supporting hyperplane) open_in_new

A function $\phi: \R^m \to \R$ is said to have a supporting hyperplane at $\v b\in\R^m$ if there exists some $\v \lambda\in\R^m$ such that for all $\v c\in\R^m$, $$ \begin{align*} \phi(\v c) \geq \phi(\v b) + \lambda^T(\v c - \v b). \end{align*} $$

  • If $\phi: \R^m \to\R$ is differentiable at $\v b$ and has a supporting plane $\v \lambda$ at $\v b$, then $\v \lambda = \nabla\phi(\v b)$. (Proof)

  • $\phi$ is convex iff there exists a supporting hyperplane at every point $\v b\in\R^m$.

Definition (value function) open_in_new

See here for notation.

Define the value function $\phi: \R^m \to \R$ as $$ \begin{align*} \phi(\v c) = \min_{\v x\in \mathcal{X}(\v c)} f(\v x) \end{align*} $$ where $\mathcal{X}(\v c) = \sb{\v x\in\mathcal{X}}{h(\v x) = \v c}$.

We want to find $\phi(\v b)$, but it is helpful to consider all possible values of $h(\v x)$.

Theorem (supporting hyperplane and strong duality) open_in_new

See here for notation. Let $\v \lambda\in\Lambda$.

Strong duality holds for $\v \lambda$ iff the value function $\phi$ has a supporting hyperplane at $\v b$.

Proof

Theorem (strong duality holds for convex problems) open_in_new

Let $\mathcal{X}\subseteq \R^n$ be a convex set and $f: \R^n \to\R$ and $h_j: \R^n\to\R$ be convex functions for all $j=1,2,\ldots,m$.

Strong duality holds for the optimisation problem

Problem

$$ \begin{align*} \text{Minimise }&f(\v x) \\ \text{over } &\v x\in\mathcal{X} \\ \text{subject to }& h_j(\v x) \leq b_j, \quad \forall j = 1,2,\ldots,m \end{align*} $$

Proof

Economic interpretation

Linear programs open_in_new

Definition (linear program) open_in_new

A linear program is an optimisation problem where the objective function and constraints are all linear, i.e. one in the form

Problem

$$ \begin{align*} \text{Minimise } &\v c^T \v x \\ \text{subject to } & \v a_i^T \v x \geq \v b_i, &&i\in M_1, \\ &\v a_i^T \v x \leq \v b_i, &&i\in M_2, \\ &\v a_i^T \v x = \v b_i, &&i\in M_3, \\ &x_j \geq 0, &&j\in N_1, \\ &x_j \leq 0, &&j\in N_2. \end{align*} $$

Definition (linear program in general form) open_in_new

The general form of a linear program is

Problem

$$ \begin{align*} \text{Minimise } & \v c^T \v x \\ \text{subject to } & A\v x \leq \v b. \end{align*} $$

Definition (linear program in standard form) open_in_new

The standard form of a linear program is

Problem

$$ \begin{align*} \text{Minimise } & \v c^T \v x \\ \text{subject to } &A\v x = \v b, \\ &\v x\geq \v 0. \end{align*} $$

Any linear programs can be written in the general form or the standard form. (Derivation)

Maxima of convex functions open_in_new

Definition (extreme point of a convex set) open_in_new

Let $C$ be a convex set.

A point $\v x\in C$ is said to be an extreme point of $C$ if it cannot be written as a convex combination of two distinct point in $C$, i.e. for $\v y,\v z\in C$ and $t\in(0,1)$, $$ \begin{align*} \v x = t\v y + (1-t)\v z\implies \v y=\v z=\v x. \end{align*} $$

Theorem (maximum of a convex function) open_in_new

Let $f$ be a convex function on a bounded convex set $C$.

$f$ attains its maximum at an extreme point of $C$.

Proof

Since linear programs are convex maximisation problems, if we find all the extreme points of the feasible set, then we can solve any linear programs.

Basic solutions and basic feasible solutions open_in_new

Consider a standard form linear program, with $A$ being an $m\times n$ matrix.

Notation (rows and columns of a matrix) open_in_new

For an $m\times n$ matrix $A$, denote

  • $\v a_1^T, a_2^T, \ldots, \v a_m^T$ the rows of $A$;

  • $\v A_1, \v A_2, \ldots, \v A_n^T$ the columns of $A$.

  • Assumption A: the rows $\v a_i$ of $A$ are linearly independent.

    This is WLOG: if rows are linearly independent, we can remove some redundant equality constraints.

    Then the rank of $A$ is $m$. Also the row vectors $\v a_i$ are in $\R^n$ so $m\leq n$.

  • Assumption B: every set of $m$ columns of $A$ are linearly independent (and therefore forms a basis).

Definition (basic solution, basic feasible solution) open_in_new

A point $\v x\in\R^n$ is called a basic solution if $A\v x = \v b$ and $\v x$ has at most $m$ non-zero entries.

$\v x$ is called a basic feasible solution if $\v x$ is a basic solution and $\v x\geq 0$.

Constructing basic solutions open_in_new

Exhaust all possible sets of $m$ indices (all $\pmat{n \\ m}$ subsets of $\set{1,2,\ldots,n}$).

For a particular choice of indices $B(1), B(2), \ldots, B(m) = 1, 2,\ldots,n$, we allow $x_{B(1)}, x_{B(2)}, \ldots, x_{B(m)}$ (the basic variables) to be non-zero (or zero) and insist the rest of $x_i$'s (non-basic variables) to be zero.

We get rid of the zero entrices in $A\v x = \v b$: let $$ \begin{align*} \text{basis matrix } B &= \underbrace{ \pmat{A_{1\,B(1)} & A_{1\,B(2)} & \ldots & A_{1\,B(m)} \\ A_{2\,B(1)} & A_{2\,B(2)} & \ldots & A_{2\,B(m)} \\ \vdots & \vdots & & \vdots \\ A_{m\, B(1)} & A_{m\,B(2)} & \ldots & A_{m\,B(m)}}}_{\text{basic columns}}, \\ \v x_B &= \pmat{x_{B(1)} \\ x_{B(2)} \\ \vdots \\ x_{B(m)}}. \end{align*} $$ Then we get $$ \begin{align*} \v A_{B(1)} x_{B(1)} + \ldots + \v A_{B(m)} x_{B(m)} = B\v x_B = \v b \end{align*} $$

By assumption B, $B$ has rank $m$, so $\v x_B = B\inv \v b$ is the unique solution.

  • Assumption C: all basic feasible solutions have exactly $m$ non-zero entrices, i.e. if $B$$\inv \v b \geq \v 0$, then $B\inv \v b > \v 0$.

Theorem (basic feasible solution iff extreme point) open_in_new

A vector $\v x$ is a basic feasible solution of $A\v x = \v b$ iff it is an extreme point of the set $\mathcal{X}(\v b) = \sb{\v x}{A\v x = \v b, \v x\geq\v 0}$.

Proof

Duality in linear programming open_in_new

Theorem (linear programs satisfy strong duality) open_in_new

A linear program that is bounded and feasible satisfies strong duality.

Proof: linear functions are convex, and convex optimisation problems satsify strong duality.

Theorem (dual problem of a linear program) open_in_new

Let $A$ be a matrix. See here for notation.

For the primal problem

Problem

$$ \begin{align*} \text{Minimise } & \v c^T \v x \\ \text{subject to } & \v a_i^T \v x \geq b_i, &&i\in M_1, \\ & \v a_i^T \v x \leq b_i, && i\in M_2, \\ & \v a_i^T \v x = b_i, && i\in M_3, \\ & x_j \geq 0, && j\in N_1, \\ & x_j \leq 0, && j\in N_2, \\ & x_j \text{ free}, && j\in N_3, \end{align*} $$

the dual problem is

Problem

$$ \begin{align*} \text{Maximise } & \v b^T \v \lambda \\ \text{subject to } & \lambda_i \geq 0, &&i\in M_1, \\ & \lambda_i \leq 0, && i\in M_2, \\ & \lambda_i \text{ free}, && i\in M_3, \\ &\v A_j^T \v \lambda \leq c_j, &&j\in N_1, \\ &\v A_j^T \v \lambda \geq c_j, &&j\in N_2, \\ &\v A_j^T \v \lambda = c_j, &&j\in N_3. \end{align*} $$

Proof

Theorem (optimality iff complementary slackness for a linear program) open_in_new

For a linear program defined here, let $\v x$ be primal feasible and $\v \lambda$ be dual feasible (i.e. feasible solutions of the primal and feasible problems).

$\v x$ and $\v \lambda$ are optimal for the two respective problems iff complementary slackness holds, i.e. $$ \begin{align*} \lambda_i(\v a_i^T \v x - b_i) &= 0 &&\forall i\in M_1\cup M_2\cup M_3, \\ (c_j - \v A_j^T \v \lambda) x_j &= 0 &&\forall j\in N_1\cup N_2\cup N_3. \end{align*} $$

Proof

Definition (reduced cost) open_in_new

Consider a linear program in standard form. Let $\v x$ be a basic solution. See here for notation.

the corresponding vector of reduced costs $\bar{\v c}$ is defined as $$ \begin{align*} \bar{\v c}^T = \v c^T - \v c_B^T B\inv A \end{align*} $$ where $\v c_B^T = (c_{B(1)}, c_{B(2)}, \ldots, c_{B(m)})$.

Theorem (optimality and reduced cost) open_in_new

In a standard form linear program, a basic feasible solution $\v x$ is optimal iff the corresponding reduced costs $\bar{\v c} \geq \v 0$.

Proof

Simplex algorithm open_in_new

Full tableau implementation open_in_new

The simplex tableau is given by $$ \begin{align*} & \begin{array}{|rl|rl|} \hline \text{current costs} & -\v c^T \v x =-\v c_B^T \v x_B & \text{reduced costs vector} & \bar{\v c} \\\hline \text{current BFS} & \v x_B = B\inv \v b & \text{basic directions} &B\inv A \\\hline \end{array} \\ \\ \equiv \quad & \begin{array}{|c|cccc|} \hline -\v c_B^T \v x_B & \bar c_1 & \bar c_2 & \ldots & \bar c_n \\\hline x_{B(1)} & | & | & & | \\ \vdots & B\inv \v A_1 & B\inv \v A_2 & \ldots & B\inv \v A_n \\ x_{B(m)} & | & | & & | \\\hline \end{array} \end{align*} $$

  1. Choose a basic feasible solution $\v x$ and compute the full simplex tableau for $\v x$.

  2. Repeat until $\bar{\v c} \geq \v 0$ (then $\v x$ is optimal):

    1. Choose some $j$ such that $\bar c_j < 0$.

    2. Consider the $j$-th column $u = B\inv A_j$ (pivot column). If no entry of $u$ is positive, then the optimal cost is $-\infty$ and we are done.

    3. For each $i$ such that $u_i > 0$, compute $x_B(i)/u_i$. Let $l$ be the row index such that this ratio is minimised.

    4. To make column $A_{B(l)}$ exit the basis and $A_j$ enter the basis, add to each row of the tableau a multiple of the $l$-th row (pivot row) so that $u_l$ (pivot element) becomes 1 and all other entries of the pivot column are 0.

Example

Explaining the simplex algorithm (non-examinable)

Two-person zero sum games open_in_new

Player 1 (P1) has $m$ choices of actions labelled $1,2,\ldots,m$, and player 2 (P2) has $n$ choices labelled $1,2,\ldots,n$.

Let an $m\times n$ matrix $A = (a_{ij})$ be the payoff matrix. If P1 plays $i$ and P2 plays $j$, P1 wins $a_{ij}$ and P2 loses $a_{ij}$.

Pure strategy open_in_new

Suppose P1 plays first. If P1 plays $i$, P2 will make the optimal choice to let P1 win $\min_{j\in\set{1,2,\ldots,n}} a_{ij}$. P1's problem is

Problem

$$ \begin{align*} \text{Maximise } &\min_{j\in\set{1,2,\ldots,n}} a_{ij} \\ \text{over } &i\in\set{1,2,\ldots,m}. \end{align*} $$

Similarly if P2 plays first, P2's problem is

Problem

$$ \begin{align*} \text{Minimise } &\max_{i\in\set{1,2,\ldots,m}} a_{ij} \\ \text{over } &j\in\set{1,2,\ldots,n}. \end{align*} $$

Definition (saddle point of zero sum games) open_in_new

An outcome $(i^\ast, j^\ast)$ of a two-person zero sum game is called a saddle point if $$ \begin{align*} \max_i \min_j a_{ij} = \min_j \max_i a_{ij} \end{align*} $$ and the extrema are attained at $(i^\ast, j^\ast)$.

If the payoff matrix has a saddle point, the players' decisions are the same regardless of who plays first.

Example (payoff matrices with and without saddle points)

Mixed strategy open_in_new

We now allow P1 to randomly choose action $i$ with probability $p_i$. P1 picks the distribution $\v p=(p_1,p_2,\ldots,p_m)$ and P2 picks $\v q=(q_1, q_2, \ldots, q_n)$.

If P1 plays $\v p$, P2 will make the optimal choice $j$ to let P1 win $\min_j \sum_i p_i a_{ij}$. P1's problem is

Problem

$$ \begin{align*} \text{Maximise } & \min_j \sum_i p_i a_{ij} \\ \text{over } & \v p \in\R^m \\ \text{subject to } & \sum_i p_i = 1, \\ & \v p\geq \v 0, \end{align*} $$

which is equivalent to

Problem

$$ \begin{align*} \text{Maximise } & v \\ \text{over } & v\in\R,\ \v p\in\R^m \\ \text{subject to } & A^T \v p \geq v \v e, \\ & \v e^T \v p = 1, \\ & \v p\geq \v 0 \end{align*} $$

where $\v e = (1,1,\ldots,1)^T$.

Similarly P2's problem is

Problem

$$ \begin{align*} \text{Minimise } & \max_i \sum_j q_j a_{ij} \\ \text{over } & \v q\in\R^n \\ \text{subject to } & \sum_j q_j = 1, \\ & \v q \geq \v 0, \end{align*} $$

which is equivalent to

Problem

$$ \begin{align*} \text{Minimise } & w \\ \text{over } & w\in\R, \ \v q\in\R^n \\ \text{subject to } & A\v q \leq w\v e, \\ & \v e^T \v q = 1, \\ & \v q \geq 0. \end{align*} $$

These two problems are dual of each other. (Derivation)

Theorem (optimality of mixed strategy in two-person zero sum games) open_in_new

In a mixed strategy two-person zero sum game, a strategy $\v p\in\R^m$ is optimal for P1 iff there exists $\v q\in\R^n$ and $v\in\R$ such that the following holds:

  • primal feasibility: $A^T \v p \geq v \v e$, $\v e^T \v p=1$ and $\v p\geq \v 0$;

  • dual feasibility: $A\v q\leq v \v e$, $\v e^T \v q = 1$ and $\v q\geq \v 0$; and

  • complementary slackness: $v = \v p^T A \v q$.

Proof

Tips for finding optimal strategies:

  1. Look for a saddle point of the payoff matrix.

  2. Look for dominating actions: if we have rows $i$ and $i'$ with $a_{ij}\geq a_{i'j}$ for all $j$, then P1 will never play $i'$. Similar for columns.

  3. Solve the linear program graphically or using the simplex method.

Network flow open_in_new

Definition (graph) open_in_new

A directed graph is a tuple $G=(V,E)$ where $V$ is the set of vertices and $E\subseteq V\times V$ is a set of ordered edges.

$G$ is called an undirected graph if $E$ is symmetric, i.e. for all $(v,v')\in E$, we have $(v',v)\in E$ as well.

Minimum cost flow problem open_in_new

Let a graph $G = (V, E)$ where $V=\set{1,2,\ldots,n}$.

For each edge $(i,j)\in E$, an amount $x_{ij}$ flows from vertex $i$ to vertex $j$. We impose the following constraints:

  • Flow is conserved at each vertex. We fix a vector $\v b\in\R^n$ which indicates the amount of flow $b_i$ that enters a vertex $i$. A vertex with $b_i>0$ is called a source and a vertex with $b_i<0$ is called a sink.

  • $n\times n$ matrices $\underline{M} = (\underline{m}_{ij})$ and $\overline{M} = (\overline{m}_{ij})$ give the lower and upper bounds for the flow $x_{ij}$.

  • $n\times n$ matrices $C = (c_{ij})$ gives the cost per unit flow on the edge $(i,j)$.

Minimal cost flow problem

$$ \begin{align*} \text{Minimise } & \sum_{(i,j)\in E} c_{ij} x_{ij} \\ \text{subject to } & b_i + \sum_{(j,i)\in E} x_{ji} = \sum_{(i,j)\in E} x_{ij} \quad \forall i\in V, \\ & \underline{m}_{ij} \leq x_{ij} \leq \overline{m}_{ij}. \end{align*} $$

For the problem to be feasible, we require $\sum_{i\in V} b_i = 0$.

Transport problem open_in_new

We have $n$ suppliers labelled $i=1,2,\ldots,n$, each supplying $s_i$ units of products. There are also $m$ consumers labelled $j=1,2,\ldots,m$, each demanding $d_i$ units of products. Transporting one unit of product from $i$ to $j$ costs $c_{ij}$.

This is a special case of the minimum cost flow problem, with $G$ being a bipartite graph and $E$ only consists of edges from a supplier to a consumer.

Transport problem

$$ \begin{align*} \text{Minimise } &\sum_{(i,j)\in E} c_{ij} x_{ij} \\ \text{subject to } &\sum_{j=1}^{m} x_{ij} = s_i && \forall i=1,2,\ldots,n, \\ &\sum_{i=1}^{n} x_{ij} = d_j && \forall j=1,2,\ldots,m, \\ &x_{ij} \geq 0 &&\forall (i,j)\in E. \end{align*} $$

We can let $E = V\times V$ and set the cost of the non-existent edges to be infinity.

Transport problem

$$ \begin{align*} \text{Minimise } &\sum_{i=1}^{n} \sum_{j=1}^{m} c_{ij} x_{ij} \\ \text{subject to } &\sum_{j=1}^{m} x_{ij} = s_i && \forall i=1,2,\ldots,n, \\ &\sum_{i=1}^{n} x_{ij} = d_j && \forall j=1,2,\ldots,m, \\ &x_{ij} \geq 0 &&\forall (i,j)\in E. \end{align*} $$

Theorem (equivalence of minimum cost flow and transport problem) open_in_new

Every minimum cost flow problem with finite capacities or non-negative capacities can be recast as an equivalent transport problem.

Proof

Theorem (optimality in the transport problem) open_in_new

Consider the transport problem. If for some feasible $x$, we have dual variables $\v \lambda\in\R^n$ (for suppliers) and $\v\mu\in\R^m$ (for consumers) such that the following holds:

  • dual feasibility: $c_{ij}\geq \lambda_i + \mu_j$ for all $i,j$; and

  • complementary slackness: $(c_{ij} - \lambda_i - \mu_j)x_{ij} = 0$,

then $x$ is optimal.

Proof

Note that optimality only depends on $\lambda_i + \mu_j$, so WLOG we can assume $\lambda_1 = 0$ by subtracting all $\lambda$ and adding all $\mu$ by $\lambda_1$.

Transport algorithm open_in_new

The transport tableau is as follow:

To construct an initial basic feasible solution, we use the northwest corner rule:

  1. Start with any edge variable, and increase it until the supply or demand is satisfied.

  2. If supply is satisfied, move to the next supplier and repeat step 1.

  3. If demand is satisfied, move to the next consumer and repeat step 1.

In a non-degenerate problem, we assume we arrive at a spanning tree $T$, i.e. a connected graph with no cycles. So there are exactly $n+m-1$ edges with positive flow.

We keep updating the current solution:

  1. If $c_{ij} \geq \lambda_i + \mu_j$ for all $i,j$, then the current solution is optimal and the algorithm is terminated.

  2. Otherwise let $(i,j)$ be such that $c_{ij} < \lambda_i + \mu_j$. By complementary slackness, $x_{ij} = 0$, so $(i,j)\not\in T$. Then $(i,j)$ and those edges in $T$ form a cycle.

  3. Along this cycle, increase the flow $x_{ij}$ until some flow in the cycle decreases to zero.

  4. Update the dual variables.

Example (transport algorithm)

Maximum flow problem open_in_new

Given a graph with a single source (vertex 1) and a single sink (vertex $n$), find the maximum possible flow $\delta$ between the source and the sink subject to capacity constraints.

Maximum flow problem

$$ \begin{align*} \text{Maximise } &\delta \\ \text{subject to } & \sum_{j:\ (i,j)\in E} x_{ij} - \sum_{j:\ (j,i)\in E} x_{ji} = 0 &&\forall i\neq 1,n, \\ & \sum_{j:\ (1,j)\in E} x_{1j} - \sum_{j:\ (j,1)\in E} x_{j1} = \delta, \\ & \sum_{j:\ (n,j)\in E} x_{nj} - \sum_{j:\ (j,n)\in E} x_{jn} = -\delta, \\ & 0 \leq x_{ij} \leq c_{ij} &&\forall (i,j)\in E. \end{align*} $$

Definition (cut of a graph) open_in_new

A cut of a graph $G = (V,E)$ is a partition of $V$ into $(S, V\setminus S)$.

Definition (capacity of a cut) open_in_new

The capacity of a cut $(S,V\setminus S)$ of a graph $G=(V,E)$ is $$ \begin{align*} c(S) = \sum_{(i,j)\in E: \ i\in S, \ j\in V\setminus S} c_{ij} \end{align*} $$ where $c_{ij}$ is the capacity of edge $(i,j)$.

Theorem (total flow does not exceed cut capacity) open_in_new

Let $x$ be a feasible flow of the maximum flow problem with flow $\delta$.

Then for any cut $(S,V\setminus S)$ such that $1\in S$ and $n\in V\setminus S$, we have $\delta\leq c(S)$.

Proof

Definition (augmenting path) open_in_new

In a graph $G=(V,E)$, a path is defined as a sequence of vertices $(v_1,v_2, \ldots, v_k)$ where each pair of adjacent vertices is connected, i.e. $(v_i, v_{i+1})$ or $(v_{i+1}, v_i) \in E$ for all $i=1,2,\ldots,k-1$.

Let $c_{ij}$ be the capacity of edge $(i,j)\in E$. For a flow $x$, a path is called an augmenting path if a forward edge is not full yet and a backward edge is not zero, i.e. $x_{v_i v_{i+1}} < c_{v_iv_{i+1}}$ when $(v_i, v_{i+1})\in E$ and $x_{v_{i+1} v_i} > 0$ when $(v_{i+1}, v_i)\in E$.

Observe that we can "push" a sufficiently small value $\epsilon$ along an augmenting path by adding a flow of $\epsilon$ along forward edges and subtracting $\epsilon$ along backward edges. So if there is an augmenting path from $1$ to $n$, then the flow is not optimal. (Example)

Theorem (max-flow min-cut) open_in_new

In a maximum flow problem, let $\delta^\ast$ be the optimal value. Then $$ \begin{align*} \delta^\ast = \min\sb{c(S)}{S\subset V,\ 1\in S,\ n\in V\setminus S}. \end{align*} $$

Proof

Ford-Fulkerson algorithm open_in_new
  1. Start with a feasible flow, say the zero flow $x=0$.

  2. While there exists an augmenting path from $1$ to $n$:

    1. Push as much as possible through the path.

  3. $x$ is now optimal. We can find a cut with capacity equal to the amount of flow.

Example

If the capacity is an integer, the algorithm is guaranteed to terminate. Otherwise it may have infinite steps.