4.6.29 · HinglishTheory of Computation

Approximation algorithms — approximation ratio, examples

1,845 words8 min readRead in English

4.6.29 · Coding › Theory of Computation


WHAT is an approximation ratio?


Example 1 — Vertex Cover (2-approximation)

Algorithm (Maximal Matching based):

  1. .
  2. Jab tak koi uncovered edge ho: dono aur ko mein daalo, saari edges jo ya ko touch karti hain unhe delete karo.
  3. return karo.
Figure — Approximation algorithms — approximation ratio, examples

Example 2 — Metric TSP (2-approximation via MST)

Algorithm (Double-tree):

  1. Ek Minimum Spanning Tree banao.
  2. ka DFS/Euler walk karo (har edge twice) → walk cost .
  3. Repeated cities ko shortcut karo (already-visited ko skip karo) → ek valid tour.

Example 3 — Load Balancing (Greedy, 2-approximation)

jobs ko machines pe assign karo, makespan (max load) minimize karo.




Recall Feynman: ek 12-saal ke bacche ko explain karo

Socho ek backpack ko perfect tarike se pack karna forever lagg jaata hai. Iske bajaye tum ek quick rule of thumb use karte ho. Tum exactly nahi bata sakte ki perfect packing kitni achi hai — lekin tum ek floor dhundh sakte ho: "perfect packing ko kam se kam itni space chahiye." Phir tum dikhate ho "mera quick tarika us floor se zyada se zyada double use karta hai." Kyunki perfect answer bhi floor ke upar hai, mera quick answer perfect wale se zyada se zyada double hai. Woh promise — perfect answer jaane bina — approximation ratio hai.


Connections

  • NP-completenesskyun hum approximate karte hain.
  • Vertex Cover · Maximum Matching — 2-approx lower bound.
  • Minimum Spanning Tree — Metric TSP ka bound.
  • Greedy Algorithms — load balancing.
  • PTAS and FPTAS · Inapproximability / PCP theorem.
  • Triangle Inequality — shortcutting enable karta hai.

Minimization problem ke liye approximation ratio kya hota hai?
Worst-case ratio ALG/OPT ≤ ρ (ρ≥1) saare inputs par; ρ=1 exact hai.
Hum OPT jaane bina ratios kyun prove kar sakte hain?
Ek lower bound LB ≤ OPT dhundho (matching size, MST cost, average load), prove karo ALG ≤ ρ·LB, phir ALG ≤ ρ·LB ≤ ρ·OPT.
Vertex Cover 2-approx: algorithm kya hai?
Baar baar koi bhi uncovered edge chuno, DONO endpoints ko cover mein daalo, incident edges remove karo.
Vertex Cover proof mein OPT ≥ |M| kyun hai?
Choose ki gayi edges ek matching banati hain; har disjoint edge ko ≥1 distinct cover vertex chahiye, isliye OPT ≥ matching size.
Vertex Cover mein ALG = 2|M| kyun hai?
Hum exactly 2 vertices per matched edge dalete hain.
Metric TSP double-tree: OPT par lower bound?
Optimal tour se ek edge hatao toh spanning tree milta hai, isliye cost(MST) ≤ OPT.
Shortcutting tour cost kyun nahi badhata?
Triangle inequality: ek city skip karna (a→c instead of a→b→c) ≤ detour cost hai.
Load balancing greedy ratio aur kyun?
2; kyunki OPT ≥ average load aur OPT ≥ max job size, aur L ≤ (L−t_j)+t_j ≤ 2·OPT.
PTAS aur FPTAS mein kya farq hai?
Dono (1+ε)-approx dete hain; FPTAS n AND 1/ε mein polynomial time mein chalta hai, PTAS sirf n mein (1/ε mein exponential ho sakta hai). Har FPTAS ek PTAS hai.
Kya general (non-metric) TSP mein constant-factor approximation hai?
Nahi (unless P=NP).
"2-approximation" ke baare mein common myth?
Yeh probability/percentage NAHI hai; yeh deterministic worst-case bound hai: ALG ≤ 2·OPT hamesha.

Concept Map

motivate

runs in

guarantees

min case ALG/OPT le rho

max case ALG/OPT ge rho

proven via

LB le OPT gives

solved by

picked edges form

lower bound LB = size of M le OPT

adds 2 verts per edge, ALG = 2 times size of M

yields

NP-hard problems

Approximation algorithm

Polynomial time

Approximation ratio rho

Minimization

Maximization

Bound on OPT, not OPT itself

ALG le rho*LB le rho*OPT

Vertex Cover

Maximal matching algorithm

Matching M

2-approximation