Lecture 17
- Using DP for approximation algorithms
- Network flow: Ford-Fulkerson "Hill climbing"
Minimum makespan
Remember we can solve the problem in \( O(n^2 A) \) time, where \( A := \max a_i \). However, this could be exponential in the number of bits used to represent the problem (A could be large).
Given \( a_1, a_2, ..., a_n \). \( \text{Sum} := \sum_{i = 1} ^ n a_i \). OPT >= Sum / 2. \( B = \epsilon (Sum / (2n)) \). Define \( \hat{a_i} := \lceil \frac{a_i}{B} \rceil \leq \lceil \frac{2n}{\epsilon} \rceil \). You can compute the approximate solution \( \hat{s} \) in \( O(n^3 / \epsilon) \) time.
Claim: Let loadi(s) be the load of machine i in the exact solution. Let loadhati(s) be the load of machine i in the approximate solution. B * loadhati - \epsilon * OPT <= loadi(s) <= B * loadhati(s).o
makespan(SHat) = max(load1(SHat), load2(SHat)) <= max(B loadhat1(SHat), b loadhat2 (SHat)) = B max(loadhat1(SHat), loadhat2(SHat)) <= B max(loadhat1(Sopt), loadhat2(Sopt)) <= max (load1(Sopt) + epsilon * OPT, load2(Sopt) + epsilon * OPT) = OPT * (1 + epsilon)
This is called a fully polynomial time approximation scheme.
Network flow
In network flow, you are given a directed graph with nonnegative edge weights. The edge weights are called "capacities". You are also given a source and sink node in the graph. A legal flow \( F((u, v)) \) is a function on the edges specifying how much is flowing between any pair of nodes. There are some laws: Conservation: For all nodes that are not source or sink, the total flow in must equal the total flow out. Capacity: For all edges, \( 0 \leq F((u, v)) \leq c((u, v)) \), where \( c(\cdot) \) denotes edge capacity. \( Flow(F) := \sum_u F((s, u)) - F((u, s)) \). Objective is to maximize flow.
def FF(G, c, s, t):
for every edge (u, v) in E:
if (v, u) not in E, add it with capacity 0.
F(e) <- 0 for every e.
Repeat until DFS fails:
for every e: cR(e) = c(e) - F(e) + F(eR)
GR: set of edges with cR(e) > 0.
Find a path from s to t in GR
Let e in p of minimal cR(e), f <- cR(e)
Decrease flow along eR by min(f, F(eR))
increase flow long e by remaining amount f - min(f, F(eR))
Say F(t) is our flow after t iterations, and say c((u, v)) are integers. Then Flow(F(t + 1)) - Flow(F(t)) >= 1. So the algorithm terminates.