Timo I. Denk, TINF16B1, DHBW Karlsruhe
Theoretical CS Seminar (April 12, 2019)
Slides available at timodenk.com/talks/ptas
Polynomial-time approximation schemes
Approximate solutions to $\mathit{NP}$-hard problems in $\mathit{P}$ time
Solution for $I$ has an objective function value $\in\mathbb{R}^+$
Example: length of the path found for a TSP instance
Algorithm $\mathcal{A}_\epsilon$ with polynomial runtime in $n$
$$\forall I\in D_\Pi \left[ \frac{\mathcal{A}_\epsilon(I)}{\text{OPT}(I)}\le1+\epsilon \right]$$
Approximation quality $\epsilon\in(0,\infty)$; $\Pi$ is a minimization problem
PTAS with polynomial runtime in $n$ and $\frac{1}{\epsilon}$
$$\mathcal{O}\left(n^\alpha\times\frac{1}{\epsilon^\beta}\right)$$
with $\alpha,\beta\ge1$
PTAS but not FTPAS (examples): $\mathcal{O}(n^\frac{1}{\epsilon})$ or $\mathcal{O}(n^{\frac{1}{\epsilon}!})$
Type | Runtime | Exact |
---|---|---|
Naive | $\mathcal{O}\mathopen{}\left(2^n\right)\mathclose{}$ | ✔ |
Dynamic programming | $\mathcal{O}(nP)$ | ✔ |
Greedy | $\mathcal{O}(n\log n)$ | fixed rel. guarantee |
FPTAS | $\mathcal{O}\mathopen{}\left(\frac{n^3}{\epsilon}\right)\mathclose{}$ | choosable rel. guarantee $\epsilon$ |
Denoted by knapsack_dp
Takes a weight limit $W$ and a set of objects $X=\{x_1,\dots,x_n\}$
Each $x_i$ has a $\operatorname{weight}(x_i)\in\mathbb{Z}^+\le W$ and a $\operatorname{profit}(x_i)\in\mathbb{Z}^+$
Outputs the exact solution $\text{OPT}$ in runtime
$$\mathcal{O}(nP)$$
where $n=\lvert X\rvert$, $P:=\operatorname{profit}(X)=\sum_{x_i\in X}\operatorname{profit}(x_i)$
def knapsack_fptas(weights, profits, W):
scaled_profits = [ceil(p/sigma) for p in profits]
approx_solution = knapsack_dp(weights, scaled_profits, W)
return approx_solution
knapsack_dp
knapsack_dp
runs in $\mathcal{O}(nP)$
Reducing $P$ is achieved by downscaling by $\sigma$ and rounding up:
$$\operatorname{profit}^*(x_i):=\left\lceil\frac{\operatorname{profit}(x_i)}{\sigma}\right\rceil$$
Lower bound: $\text{LB}=\max_i\operatorname{profit}(x_i)$
$$\operatorname{profit}^*(x_i)=\left\lceil\frac{n}{\epsilon}\frac{\operatorname{profit}(x_i)}{\text{LB}}\right\rceil\in\left\{1,\dots,\left\lceil\frac{n}{\epsilon}\right\rceil\right\}$$
Each profit is $\le\left\lceil\frac{n}{\epsilon}\right\rceil$
Upper bound of $P$: $P\le n\times\left\lceil\frac{n}{\epsilon}\right\rceil$
$P:=\operatorname{profit}(X)=\sum_{x_i\in X}\operatorname{profit}(x_i)$
$$\mathcal{O}\left(n\times n\times\left\lceil\frac{n}{\epsilon}\right\rceil\right)\subseteq\mathcal{O}\left(\frac{n^3}{\epsilon}\right)$$
Both $n$ and $\epsilon$ occur polynomially ⇒ FPTAS
See Section 3.1 in the accompanying document
timodenk.com/arxiv/201904-ptas.pdf
Given a complete, weighted graph with non-negative edge costs, find a route that visits every node exactly once with minimum cost.
$\text{OPT}$ is the cost of the best path
TSP does not admit a PTAS unless $\mathit{P}=\mathit{NP}$
Proof by contradiction
Decision problem, input graph $G$
Whether a cycle exists such that each node is visited exactly once
Convert graph $G$ (Hamiltonian) to $G'$ (TSP input):
Suppose there was a PTAS with approximation guarantee $1+\epsilon$
With $w=(1+\epsilon)\times\lvert V\rvert$, the TSP-PTAS could be used to decide the Hamiltonian cycle problem in polynomial time.
Number of nodes: $\lvert V\rvert$