Equivalent: for each feasible solution x to L with objective value z, there is a corresponding feasible solution x′ to L′ with objective value z′, and for each feasible solution x′ to L′ with objective value z′, there is a corresponding feasible solution x to L with objective value ́.
Standard Form
Maximize ∑j=1ncjxj
subject to ∑j=1naijxj≤bi,xj≥0
Converting to Stand Form
Turn Minimize to Maximize
x=x1−x2,x1>0,x2>0
Turn equation to inequation
Turn ≥ to ≤
(A,b,c)
Maximize cTx
subject to Ax≤b,x≥0
Slack Form
Maximize ∑j=1ncjxj
subject to
xn+i=∑j=1ntjxj≥0
xi≥0
basic variable: Left side of equation
nonbasic variable: Right side of equation
(N,B,A,b,c,v)
Maximize cTx+v
subject to
xi=bi−∑j∈Naijxj,i∈B
xi≥0,i∈N
Simplex Algorithm
pivot: choose a nonbasic varible(entering variable) and a basic variable(leaving variable) and exchange their roles.
(N,B,A,b,c,v)→(N^,B^,A^,b^,c^,v^)
at most (mn+m) iterations, otherwise cycles
Bland's rule: choose smallest index then must terminate
//n: number of variable//m: number of restrictionvoid pivot(int l, int e) { // Update leaving basic variable b[l] /= a[l][e]; for (int j = 1; j <= n; j++) if (j != e) a[l][j] /= a[l][e]; a[l][e] = 1 / a[l][e]; // Update other basic variable for (int i = 1; i <= m; i++) if (i != l && fabs(a[i][e]) > 0) { b[i] -= a[i][e] * b[l]; for (int j = 1; j <= n; j++) if (j != e) a[i][j] -= a[i][e] * a[l][j]; a[i][e] = -a[i][e] * a[l][e]; } // Update entering nonbasic variable ans += c[e] * b[l]; for (int j = 1; j <= n; j++) if (j != e) c[j] -= c[e] * a[l][j]; c[e] = -c[e] * a[l][e];}double simplex() { while (true) { int enter = 0, leave = 0; // Select enter variable for (enter = 1; enter <= n; ++enter) if (c[enter] > eps) break; if (enter == n + 1) return ans; // Select leave variable double mn = INF; for (int i = 1; i <= m; ++i) if (a[i][enter] > eps && mn > b[i] / a[i][enter]) { mn = b[i] / a[i][enter]; leave = i; } if (mn == INF) return INF; pivot(leave, enter); }}
Formulating Problems
Shortest Path
Maximize dt
subject to dv≤du+w(u,v),ds=0
Maximum Flow
Maximize ∑v∈Vfsv−∑v∈Vfvs
subject to fuv≤c(u,v),∑v∈Vfvu=∑v∈Vfuv,fuv≥0
Minimum-cost Flow
Minimize ∑(u,v)∈Ea(u,v)fuv
subject to fuv≤c(u,v),∑v∈Vfvu−∑v∈Vfuv=0,fuv≥0,∑v∈Vfsv−∑v∈Vfvs=d
Multicommodity Flow
Minimize 0
subject to ∑i=1kfiuv≤c(u,v),∑v∈Vfiuv−∑v∈Vfivu=0,∑v∈Vfisiv−∑v∈Vfivsi=di,fiuv≥0
vertex cover
min∑v∈Vxvs.t.∑v∈exv≥1,e∈Exv∈{0,1},v∈V
System of difference contraints
subject to: xi−xj≤ck (m pairs)
Duality
Prime
mincTxs.t.Ax≥bx≥0
Dual
maxbTys.t.yTA≤cTy≥0
prime
dual
maxc1x1+⋯+cnxn
minb1y1+⋯+bmym
aTx≥b
yi≤0
aTx=b
-
aTx≤b
yi≥0
-
yi=0
xi≥0
aTy≥c
xi≤0
aTy≤c
-
aTy=c
xi=0
-
Weak Duality Theorem: ∀ feasible primal solution x and dual solution y
yTb≤yTAx≤cTx
Strong Duality Theorem: Primal LP has finite optimal solution x∗ iff dual LP has finite optimal solution y∗Tb=cTx∗
Complementary Slackness Condition: ∀ feasible primal solution x and dual solution y, both x and y are optimal iff
∀i:Ai⋅x=bi∨yi=0∀j:yTA⋅j=cj∨xj=0
Relaxed Complementary Slackness: ∀ feasible primal solution x and dual solution y, for α,β≥1
raise αj for all client j simultaneously at a uniform continous rate
upon αj=dij for a closed facility i: edge (i,j) is paid, fix βij=αj−dij
upon ∑j∈Cβij=fi: tentatively open facility i; all unconnected clients j with paid edge (i,j) to facility i are declared connected to facility i and stop raising αj
upon αj=dij for an unconnected client j and tentatively open facility i: client j is declared connected to facility i and stop raising α
Integrality Gap: 3
LP Relaxation & Rounding
Represent problem as Integer Linear Program(ILP)
Relaxation: relax ILP to LP
Find the optimal fractional solution x∗ of LP
ellipsoid
interior-point
Rounding: round the solution to a feasible integral solution x^