TExcelTAD
Home › Approximation Algorithms › Approximation Ratios and Lower Bounds on OPT

Approximation Ratios and Lower Bounds on OPT

Before designing algorithms we fix what "approximately optimal" means, for minimization and maximization alike, and look at the one idea every proof in this course rests on: the optimum is unknown, so the algorithm is compared with a bound on it that can be computed or reasoned about.

Optimization problems

An NP optimization problem Π\Pi consists of

  • a set of instances, recognizable in polynomial time;
  • for each instance II, a set of feasible solutions F(I)\mathcal{F}(I), each of size polynomial in ∣I∣\lvert I \rvert, with membership checkable in polynomial time;
  • an objective f(I,S)≥0f(I, S) \ge 0 computable in polynomial time, to be minimized or maximized.

OPT(I)\text{OPT}(I) is the best objective value over F(I)\mathcal{F}(I). Vertex cover (minimize the number of vertices touching every edge), set cover, TSP, bin packing and makespan scheduling are minimization problems; knapsack, max-cut, MAX-SAT and maximum independent set are maximization problems. The decision version ("is there a solution of value at most kk?") is in NP, and for all of these problems it is NP-complete, so unless P = NP no polynomial algorithm computes OPT.

Approximation ratios

Definition. An algorithm AA for a minimization problem is a ρ\rho-approximation algorithm (ρ≥1\rho \ge 1) if it runs in polynomial time and for every instance II returns a feasible solution with

ALG(I)≤ρ⋅OPT(I).\text{ALG}(I) \le \rho \cdot \text{OPT}(I) .

For a maximization problem, ρ≤1\rho \le 1 and the requirement is ALG(I)≥ρ⋅OPT(I)\text{ALG}(I) \ge \rho \cdot \text{OPT}(I).

The factor ρ\rho may depend on the input size: greedy set cover is an HnH_n-approximation, where nn is the number of elements. Three variants appear later:

  • Asymptotic ratio: ALG(I)≤ρ⋅OPT(I)+c\text{ALG}(I) \le \rho \cdot \text{OPT}(I) + c for a constant cc. First-fit decreasing for bin packing is 119OPT+69\frac{11}{9}\text{OPT} + \frac{6}{9}, far better than its absolute ratio 32\frac{3}{2}.
  • Absolute approximation: ALG(I)≤OPT(I)+c\text{ALG}(I) \le \text{OPT}(I) + c. Rare, but it exists: every graph can be edge-coloured with at most Δ+1\Delta + 1 colours (Vizing, 1964), while Δ\Delta colours are needed, so an algorithm following Vizing's proof is within 1 of optimal although deciding between Δ\Delta and Δ+1\Delta + 1 is NP-hard (Holyer, 1981).
  • Randomized: the guarantee holds for the expected value, E[ALG(I)]≤ρ⋅OPT(I)\mathbb{E}[\text{ALG}(I)] \le \rho \cdot \text{OPT}(I), or with high probability.

A ratio is tight for an algorithm when instances exist on which it comes arbitrarily close to ρ\rho. Tightness of the analysis is a statement about one algorithm; whether another algorithm could do better is a question for hardness of approximation.

Why absolute guarantees are rare

For problems whose objective scales with the numbers in the input, an additive guarantee would solve the problem exactly. Knapsack is the standard example.

Claim. If P ≠\ne NP, no polynomial algorithm for knapsack guarantees ALG≥OPT−c\text{ALG} \ge \text{OPT} - c for a constant cc.

Proof. Suppose AA does. Given an instance with integer profits, multiply every profit by c+1c + 1 and run AA. Feasible solutions are unchanged, and every value is a multiple of c+1c + 1. The solution returned is within cc of the scaled optimum, so it is within cc+1<1\frac{c}{c+1} < 1 of the original optimum, and since original values are integers it is optimal. That solves an NP-hard problem in polynomial time. □\square

The program applies the scaling trick to a deliberately sloppy algorithm, an exact solver that throws away a few units of profit, to show the mechanism.

python · try it yourself
from itertools import combinations

items = [(13, 7), (11, 6), (9, 5), (8, 4), (6, 3), (4, 2)]   # (profit, size)
B = 14

def solutions(items, B):
    for r in range(len(items) + 1):
        for S in combinations(range(len(items)), r):
            if sum(items[i][1] for i in S) <= B:
                yield S

def sloppy(items, B, c):
    """Returns some feasible set within c of optimal: the worst such set."""
    vals = {S: sum(items[i][0] for i in S) for S in solutions(items, B)}
    opt = max(vals.values())
    return min((S for S in vals if vals[S] >= opt - c), key=lambda S: (vals[S], S))

c = 3
opt = max(sum(items[i][0] for i in S) for S in solutions(items, B))
S = sloppy(items, B, c)
print("OPT", opt, " sloppy answer", S, "value", sum(items[i][0] for i in S))
scaled = [(p * (c + 1), s) for p, s in items]
S2 = sloppy(scaled, B, c)
print("after scaling profits by", c + 1, ": answer", S2, "original value", sum(items[i][0] for i in S2))
OPT 27  sloppy answer (0, 1) value 24
after scaling profits by 4 : answer (0, 3, 4) original value 27

The additive error of 3 was used in full on the original instance (24 instead of 27), but after scaling every suboptimal solution is at least 4 units worse, so the same sloppiness cannot hide any more. Ratios are invariant under scaling, which is why the course measures quality multiplicatively.

Bounding the optimum

A proof that ALG≤ρ⋅OPT\text{ALG} \le \rho \cdot \text{OPT} for a minimization problem almost always has the shape

ALG≤ρ⋅LB≤ρ⋅OPT,\text{ALG} \le \rho \cdot \text{LB} \le \rho \cdot \text{OPT},

where LB is a lower bound on OPT that the algorithm can relate to its own cost. For maximization, the roles flip: an upper bound UB ≥\ge OPT with ALG≥ρ⋅UB\text{ALG} \ge \rho \cdot \text{UB}. The design of an approximation algorithm is often the design of the right bound.

Problem Bound on OPT Why it holds
vertex cover size of any matching each matching edge needs its own cover vertex
metric TSP weight of a minimum spanning tree a tour minus an edge is a spanning tree
makespan on mm machines max⁡(pmax⁡,1m∑jpj)\max(p_{\max}, \frac{1}{m}\sum_j p_j) some machine gets the longest job; the average load is attained by some machine
knapsack (upper bound) fractional optimum the LP relaxation contains every integral solution
any covering IP LP relaxation value, or any feasible dual solution relaxing can only lower a minimum; weak duality

The LP bound is the most powerful because it comes with a dual: every feasible dual solution is a lower bound, and an algorithm that builds a dual solution as it runs, as in The Primal-Dual Method for Vertex Cover, carries its own certificate. Its limit is the integrality gap (Integrality Gaps): no analysis against the LP value can prove a ratio better than the worst-case ratio between OPT and LP.

The program computes three lower bounds for vertex cover on random graphs: a greedy maximal matching, a maximum matching (by brute force here) and the LP relaxation, and compares them with OPT.

python · try it yourself
import random
from itertools import combinations
from scipy.optimize import linprog

def opt_cover(n, E):
    for k in range(n + 1):
        for C in combinations(range(n), k):
            if all(u in C or v in C for u, v in E):
                return k

def maximal_matching(E):
    used, M = set(), 0
    for u, v in E:
        if u not in used and v not in used:
            used |= {u, v}
            M += 1
    return M

def maximum_matching(E):
    for k in range(len(E), 0, -1):
        for M in combinations(E, k):
            if len({x for e in M for x in e}) == 2 * k:
                return k
    return 0

def lp_value(n, E):
    A = [[-1 if v in e else 0 for v in range(n)] for e in E]
    return linprog([1] * n, A_ub=A, b_ub=[-1] * len(E), bounds=[(0, 1)] * n, method="highs").fun

rng = random.Random(3)
print(" n  |E|  maximal  maximum    LP   OPT")
for _ in range(5):
    n = rng.randint(7, 9)
    E = [(u, v) for u in range(n) for v in range(u + 1, n) if rng.random() < 0.35]
    print(f"{n:2} {len(E):4} {maximal_matching(E):8} {maximum_matching(E):8} {float(lp_value(n, E)):5.1f} {opt_cover(n, E):5}")
 n  |E|  maximal  maximum    LP   OPT
 7    5        3        3   3.0     3
 7    5        1        2   2.0     2
 8   10        3        4   4.0     4
 7   10        3        3   3.5     4
 8    6        3        3   3.0     3

Every bound sits at or below OPT, and the LP is never below the maximum matching (a matching gives a feasible solution of the LP's dual, the fractional matching LP). Better bounds allow better ratios: matching gives 2, and so does the LP, for vertex cover; for other problems the gap between bounds is where all the progress happens.

Upper bounds for maximization

For maximization the same table is read upside down. For max-cut the total edge weight is an upper bound, and a uniformly random cut gets half of it in expectation, a 12\frac{1}{2}-approximation; Goemans and Williamson (1995) replace the trivial bound by a semidefinite one and reach 0.8780.878 (Goemans-Williamson Hyperplane Rounding). For MAX-SAT, the number of clauses is the trivial upper bound and the LP relaxation a better one (MAX-SAT: Random Assignments, LP Rounding and the Better of Two).

Note: A good lower bound can certify a solution after the fact even when the worst-case ratio is weak. Practical solvers report this as a gap: the distance between the best solution found and the best bound proved. An approximation guarantee is a gap that is promised in advance.

Test yourself

A minimization algorithm satisfies ALG≤2 OPT+3\text{ALG} \le 2\,\text{OPT} + 3 on every instance. What kind of guarantee is this?

  1. An absolute approximation
  2. An asymptotic ratio of 2: the additive constant matters only for small OPT
  3. A 5-approximation for every instance
  4. A randomized guarantee

Why can no polynomial algorithm guarantee OPT−c\text{OPT} - c for knapsack unless P = NP?

  1. Knapsack has no polynomial algorithm of any kind
  2. Scaling every profit by c+1c + 1 makes every suboptimal solution at least c+1c + 1 worse, so the guarantee would return an exact optimum
  3. Because the LP relaxation has a gap of 2
  4. Because cc must depend on nn

Which quantity is a valid lower bound on the optimal metric TSP tour?

  1. The weight of a minimum spanning tree
  2. Twice the weight of a minimum spanning tree
  3. The weight of the heaviest edge times nn
  4. The number of vertices

What limits any approximation proof that compares the algorithm with an LP relaxation value?

  1. The running time of the LP solver
  2. The integrality gap: the ratio cannot be proved better than the worst ratio between OPT and the LP value
  3. The number of constraints
  4. Nothing, LP bounds are always tight