线性规划对偶笔记

· · 算法·理论

线性规划问题

有变量 x_1,x_2,\dots,x_n 和 m 个约束条件,你需要最大(或者小)化函数 z:

\begin{gathered} \max \ z = c_1 x_1 + c_2 x_2 + \cdots + c_n x _n \\ \left\{ \begin{gathered} a_{1,1} x_1 + a_{1,2} x_2 + \cdots + a_{1,n} x_n \leq b_1\\ a_{2,1} x_1 + a_{2,2} x_2 + \cdots + a_{2,n} x_n \leq b_2\\ \cdots \\ a_{m,1} x_1 + a_{m,2} x_2 + \cdots + a_{m,n} x_n \leq b_m\\ \end{gathered} \right. \\ x_1,x_2,\cdots,x_n \geq 0 \end{gathered}

其中 \forall i,j,x_i,c_i,a_{i,j},b_j\in \mathbb{R}。

不妨设 \displaystyle x = \left[\begin{matrix}x_1\\ x_2\\ \vdots\\ x_n\end{matrix}\right],c = \left[\begin{matrix}c_1\\ c_2\\ \vdots\\ c_n\end{matrix}\right],b = \left[\begin{matrix}b_1\\ b_2\\ \vdots\\ b_m\end{matrix}\right],A = \left[\begin{matrix}a_{1,1} & a_{1,2} & \cdots & a_{1,n}\\ a_{1,1} & a_{1,2} & \cdots & a_{1,n}\\ & & \vdots & \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n}\end{matrix}\right], 则可把线性规划写成:

\begin{gathered} \max \ z = c ^ T x \\ A x \leq b \\ x \geq 0 \end{gathered}

对偶

问题

\begin{gathered} \max \ z = c ^ T x \\ A x \leq b \\ x \geq 0 \end{gathered}

的对偶是:(y 是变量)

\begin{gathered} \min \ f = b ^ T y \\ A ^ T y \geq c \\ y \geq 0 \end{gathered}

有性质 z \leq f,并且可以取等。

对偶的运筹学意义

原问题

公司要制作 n 种物品,第 i 种物品制造 x_i 个;其中,第 i 种物品的售价为 c_i;你需要最大化总售价 z(假设所有制造的物品都会被卖出);不过,共有 m 种原料,第 j 种原料公司有 b_j 个,制作第 i 个物品要使用 a_{i,j} 个原料 j。

对偶问题

你要购买公司的 m 种原料,第 j 种原料单价为 y_j;其中,第 j 种原料公司有 b_j 个,你要都买下来;你需要最小化总费用 f;不过,对于第 i 个物品,你使用购买的原料制造它时,成本必须不小于公司的售价,否则公司就会不同意交易。

对偶性的代数证明

我们要证的是 z \leq f,并且不等式可以取等。

不妨把问题写成如下形式,原问题:

\begin{gathered} \max \ z = \sum_{i = 1} ^ n c_i x_i \\ \forall j,\ \sum_{i = 1} ^ n a_{i, j} x_i \leq b_j \\ \forall i,\ x_i \geq 0 \end{gathered}

对偶问题:

\begin{gathered} \min \ f = \sum_{j = 1} ^ m c_j y_j \\ \forall i,\ \sum_{j = 1} ^ m a_{i, j} y_j \geq c_i \\ \forall j,\ y_j \geq 0 \end{gathered}

对于 \displaystyle \forall j,\ \sum_{i = 1} ^ n a_{i, j} x_i \leq b_j,我们可以先将等号两边同时乘 y_j,得到 \displaystyle \forall j,\ \sum_{i = 1} ^ n a_{i, j} x_i y_j \leq b_j y_j,然后累加,得到 \displaystyle \sum_{i = 1} ^ n \sum_{j = 1} ^ m a_{i, j} x_i y_j \leq \sum_{j = 1} ^ m b_j y_j。

同理,也可以通过 \displaystyle \forall i,\ \sum_{j = 1} ^ m a_{i, j} y_j \geq c_i 得到 \displaystyle \sum_{i = 1} ^ n \sum_{j = 1} ^ m a_{i, j} x_i y_j \geq \sum_{i = 1} ^ n c_i x_i。

这样,就可以得到 \displaystyle \sum_{i = 1} ^ n c_i x_i \leq \sum_{j = 1} ^ m b_j y_j,即 z \leq f。

那么是否一定能取等呢?我不会证捏