CSC373 Weeks 9 & 10: Approximation Algorithms & Local Search
373F19 - Nisarg Shah & Karan Singh 1
CSC373 Weeks 9 & 10: Approximation Algorithms & Local - - PowerPoint PPT Presentation
CSC373 Weeks 9 & 10: Approximation Algorithms & Local Search 373F19 - Nisarg Shah & Karan Singh 1 NP-Completeness We saw that many problems are NP-complete Unlikely to have polynomial time algorithms to solve them What
373F19 - Nisarg Shah & Karan Singh 1
373F19 - Nisarg Shah & Karan Singh 2
➢ Unlikely to have polynomial time algorithms to solve them ➢ What can we do?
➢ Instead of solving them exactly, solve them approximately ➢ Sometimes, we might want to use an approximation
algorithm even when we can compute an exact solution in polynomial time (WHY?)
373F19 - Nisarg Shah & Karan Singh 3
➢ Decision problem: “Is there…where…≥ 𝑙?”
given formula 𝜒?”
➢ Optimization problem: “Find…which maximizes…”
number of clauses from a given formula 𝜒.”
➢ Recall that if the decision problem is hard, then the
373F19 - Nisarg Shah & Karan Singh 4
➢ Our algorithm returns a solution 𝐵𝑀𝐻(𝐽) ➢ An optimal solution maximizing 𝑄𝑠𝑝𝑔𝑗𝑢 or minimizing 𝐷𝑝𝑡𝑢
is 𝑃𝑄𝑈(𝐽)
➢ Then, the approximation ratio of 𝐵𝑀𝐻 on instance 𝐽 is
𝑄𝑠𝑝𝑔𝑗𝑢 𝑃𝑄𝑈 𝐽 𝑄𝑠𝑝𝑔𝑗𝑢 𝐵𝑀𝐻 𝐽
𝐷𝑝𝑡𝑢 𝐵𝑀𝐻 𝐽 𝐷𝑝𝑡𝑢 𝑃𝑄𝑈 𝐽
373F19 - Nisarg Shah & Karan Singh 5
𝑄𝑠𝑝𝑔𝑗𝑢 𝑃𝑄𝑈 𝐽 𝑄𝑠𝑝𝑔𝑗𝑢 𝐵𝑀𝐻 𝐽
𝐷𝑝𝑡𝑢 𝐵𝑀𝐻 𝐽 𝐷𝑝𝑡𝑢 𝑃𝑄𝑈 𝐽
➢ Note: These are defined to be ≥ 1 in each case.
𝑄𝑠𝑝𝑔𝑗𝑢 𝐵𝑀𝐻 𝐽 ≥ 1 𝑑 ⋅ 𝑄𝑠𝑝𝑔𝑗𝑢 𝑃𝑄𝑈 𝐽 𝑝𝑠 𝐷𝑝𝑡𝑢 𝐵𝑀𝐻 𝐽 ≤ 𝑑 ⋅ 𝐷𝑝𝑡𝑢 𝑃𝑄𝑈 𝐽
373F19 - Nisarg Shah & Karan Singh 6
➢ Also interesting to look at approximation in the average
case when your inputs are drawn from some distribution
➢ Some books and papers use approximation ratios ≤ 1
➢ E.g. they might say 0.5-approximation to mean that the
algorithm generates at least half the optimal profit or has at most twice the optimal cost
373F19 - Nisarg Shah & Karan Singh 7
➢ For every 𝜗 > 0, there is a 1 + 𝜗 -approximation
algorithm that runs in time 𝑞𝑝𝑚𝑧 𝑜, Τ 1 𝜗 on instances of size 𝑜
➢ For every 𝜗 > 0, there is a 1 + 𝜗 -approximation
algorithm that runs in time 𝑞𝑝𝑚𝑧 𝑜 on instances of size 𝑜
1 𝜗
373F19 - Nisarg Shah & Karan Singh 8
➢ An FPTAS
➢ A PTAS but no FPTAS
➢ 𝑑-approximation for a constant 𝑑 > 1 but no PTAS
➢ Θ log 𝑜 -approximation but no constant approximation
➢ No 𝑜1−𝜗-approximation for any 𝜗 > 0
Impossibility of better approximations assuming widely held beliefs like P ≠ NP 𝑜 = parameter of problem at hand
373F19 - Nisarg Shah & Karan Singh 9
373F19 - Nisarg Shah & Karan Singh 10
➢ Input: 𝑛 identical machines, 𝑜 jobs, job 𝑘 requires
processing time 𝑢𝑘
➢ Output: Assign jobs to machines to minimize makespan ➢ Let 𝑇 𝑗 = set of jobs assigned to machine 𝑗 in a solution ➢ Constraints:
➢ Load on machine 𝑗 : 𝑀𝑗 = σ𝑘∈𝑇 𝑗 𝑢𝑘 ➢ Goal: minimize makespan 𝑀 = max
𝑗
𝑀𝑗
373F19 - Nisarg Shah & Karan Singh 11
➢ Input: Set 𝑇 containing 𝑜 integers ➢ Output: Can we partition 𝑇 into two sets with equal sum (i.e.
𝑇 = 𝑇1 ∩ 𝑇2, 𝑇1 ∩ 𝑇2 = ∅, and σ𝑥∈𝑇1 𝑥 = σ𝑥∈𝑇2 𝑥 )?
➢ Exercise!
MAKESPAN with 2 machines, then you can solve PARTITION in polynomial-time
373F19 - Nisarg Shah & Karan Singh 12
➢ Consider the 𝑜 jobs in some “nice” sorted order. ➢ Assign each job 𝑘 to a machine with the smallest load so far
➢ Implementable in 𝑃 𝑜 log 𝑛 using priority queue
➢ But this time, we can’t hope that greedy will be optimal ➢ We can still hope that it is approximately optimal
373F19 - Nisarg Shah & Karan Singh 13
➢ Regardless of the order, greedy gives a 2-approximation. ➢ This was the first worst-case approximation analysis
373F19 - Nisarg Shah & Karan Singh 14
➢ Regardless of the order, greedy gives a 2-approximation.
𝑘
➢ Some machine must process job with highest processing time
1 𝑛 σ𝑘 𝑢𝑘
➢ Total processing time is σ𝑘 𝑢𝑘 ➢ At least one machine must do at least 1/𝑛 of this work
(pigeonhole principle)
373F19 - Nisarg Shah & Karan Singh 15
➢ Regardless of the order, greedy gives a 2-approximation.
➢ Suppose machine 𝑗 is bottleneck under greedy (so load = 𝑀𝑗) ➢ Let 𝑘∗ = last job scheduled on 𝑗 by greedy ➢ Right before 𝑘∗ was assigned to 𝑗, 𝑗 had the smallest load
➢ Average over all 𝑙 : 𝑀𝑗 − 𝑢𝑘∗ ≤
1 𝑛 σ𝑘 𝑢𝑘
➢ 𝑀𝑗 ≤ 𝑢𝑘∗ +
1 𝑛 σ𝑘 𝑢𝑘 ≤ 𝑀∗ + 𝑀∗ = 2𝑀∗ Fact 1
Fact 2
373F19 - Nisarg Shah & Karan Singh 16
➢ Regardless of the order, greedy gives a 2-approximation.
➢ Essentially. ➢ There is an example where greedy does perform this badly. ➢ Note: In the upcoming example, greedy is only as bad as
➢ So 2 − 1/𝑛 is exactly tight.
373F19 - Nisarg Shah & Karan Singh 17
➢ Regardless of the order, greedy gives a 2-approximation.
➢ Example:
assigning the last heavy job makes makespan 𝑛 − 1 + 𝑛 = 2𝑛 − 1
𝑛 − 1 machines and putting the single heavy job on the remaining
➢ Idea: It seems keeping heavy jobs at the end is bad. So just
start with them first!
373F19 - Nisarg Shah & Karan Singh 18
➢ Run the greedy algorithm but consider jobs in the
decreasing order of their processing time
➢ The optimal solution must schedule that job on some
machine
373F19 - Nisarg Shah & Karan Singh 19
➢ Run the greedy algorithm but consider jobs in the
decreasing order of their processing time
➢ Suppose 𝑢1 ≥ 𝑢2 ≥ ⋯ ≥ 𝑢𝑜
➢ Consider the first 𝑛 + 1 jobs ➢ All of them require processing time at least 𝑢𝑛+1 ➢ By pigeonhole principle, in the optimal solution, at least
two of them end up on the same machine
373F19 - Nisarg Shah & Karan Singh 20
➢ Greedy with longest processing time first gives 3/2-
approximation
➢ Similar to the proof for arbitrary ordering ➢ Consider bottleneck machine 𝑗 and job 𝑘∗ that was last
scheduled on this machine by greedy
➢ Case 1: Machine 𝑗 has only one job 𝑘∗
373F19 - Nisarg Shah & Karan Singh 21
➢ Greedy with longest processing time first gives 3/2-
approximation
➢ Similar to the proof for arbitrary ordering ➢ Consider bottleneck machine 𝑗 and job 𝑘∗ that was last
scheduled on this machine by greedy
➢ Case 2: Machine 𝑗 has at least two jobs
Same as before ≤ 𝑀∗ ≤ 𝑀∗/2 𝑢𝑘∗ ≤ 𝑢𝑛+1 and Fact 4
373F19 - Nisarg Shah & Karan Singh 22
➢ Greedy with LPT rule gives 3/2-approximation ➢ Is our analysis tight? No!
➢ Greedy with LPT rule gives 4/3-approximation ➢ Is Graham’s 4/3 approximation tight?
4 3 − 1 3𝑛
4 3 − 1 3𝑛 upper bound. So this is exactly
tight.
373F19 - Nisarg Shah & Karan Singh 23
➢ Greedy with LPT rule gives 3/2-approximation ➢ Is our analysis tight? No!
➢ Greedy with LPT rule gives 4/3-approximation ➢ Tight example:
4𝑛−1 3𝑛 = 4 3 − 1 3𝑛
373F19 - Nisarg Shah & Karan Singh 24
373F19 - Nisarg Shah & Karan Singh 25
➢ Input: Undirected graph 𝐻 = (𝑊, 𝐹) ➢ Output: Vertex cover 𝑇 of minimum cardinality ➢ Recall: 𝑇 is vertex cover if every edge has at least one
endpoint in 𝑇
➢ We already saw that this problem is NP-hard
373F19 - Nisarg Shah & Karan Singh 26
➢ Start with 𝑇 = ∅ ➢ While there exists an edge whose both endpoints are not
in 𝑇, add both its endpoints to 𝑇
➢ Why are we selecting edges rather than vertices? ➢ Why are we adding both endpoints? ➢ We’ll see..
373F19 - Nisarg Shah & Karan Singh 27
373F19 - Nisarg Shah & Karan Singh 28
➢ Greedy edge-selection algorithm for unweighted vertex
cover gives 2-approximation.
➢ If 𝑇 is any vertex cover (containing 𝑇 vertices), 𝑁 is any
matching (containing |𝑁| edges), then what is the relation between |𝑇| and 𝑁 ?
➢ Answer: 𝑇 ≥ |𝑁|.
373F19 - Nisarg Shah & Karan Singh 29
➢ Greedy edge-selection algorithm for unweighted vertex
cover gives 2-approximation.
➢ Let 𝑇∗ = min vertex cover, 𝑇 = solution returned by greedy ➢ By design, 𝑇 = 2 ⋅ |𝑁| ➢ Because 𝑁 is a matching, 𝑇∗ ≥ |𝑁|
(By last slide)
➢ Hence, 𝑇 ≤ 2|𝑇∗| ∎
373F19 - Nisarg Shah & Karan Singh 30
➢ Greedy edge-selection algorithm for unweighted vertex
cover gives 2-approximation.
➢ If 𝑁∗ is maximum matching, then greedy finds matching
𝑁 with 𝑁 ≥
1 2 𝑁∗
➢ By design, 𝑁 =
1 2 |𝑇|
➢ 𝑇 ≥ 𝑁∗
(Same reason again!)
➢ Hence, 𝑁 ≥
1 2 𝑁∗ ∎ This is a so-called maximal matching which cannot be extended
373F19 - Nisarg Shah & Karan Singh 31
➢ Start with 𝑇 = ∅ ➢ While 𝑇 is not a vertex cover:
edges incident on it
➢ Interestingly, this only gives log 𝑒max approximation,
and gives provably best possible approximation ratio for set cover in polynomial time (unless P=NP)
373F19 - Nisarg Shah & Karan Singh 32
➢ Unless P = NP, there is no 𝜍-approximation polynomial-
time algorithm for unweighted vertex cover for any 𝜍 < 1.3606.
➢ We’ll see later. ➢ Basically, reduce “solving a hard problem” (e.g. 3SAT) to
“finding any good approximation of current problem”
373F19 - Nisarg Shah & Karan Singh 33
➢ Unless P = NP, there is no 𝜍-approximation polynomial-
time algorithm for unweighted vertex cover for any 𝜍 < 1.3606.
➢ We’ll see later. ➢ Basically, reduce “solving a hard problem” (e.g. 3SAT) to
“finding any good approximation of current problem”
373F19 - Nisarg Shah & Karan Singh 34
373F19 - Nisarg Shah & Karan Singh 35
➢ Input: Undirected graph 𝐻 = (𝑊, 𝐹), weights 𝑥 ∶ 𝑊 → 𝑆≥0 ➢ Output: Vertex cover 𝑇 of minimum total weight
➢ Gives arbitrarily bad approximation ➢ Obvious modification which try to take weights into
➢ Need another strategy…
373F19 - Nisarg Shah & Karan Singh 36
➢ For each vertex 𝑤, create a binary variable 𝑦𝑤 ∈ {0,1}
indicating whether vertex 𝑤 is chosen in the vertex cover
➢ Then, computing min weight vertex cover is equivalent to
solving the following integer linear program min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ∈ 0,1 , ∀𝑤 ∈ 𝑊
373F19 - Nisarg Shah & Karan Singh 37
min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ∈ 0,1 , ∀𝑤 ∈ 𝑊 min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ≥ 0, ∀𝑤 ∈ 𝑊 ILP with binary variables LP with real variables
373F19 - Nisarg Shah & Karan Singh 38
➢ Minimizes objective over a larger feasible space ➢ Optimal LP objective value ≤ optimal ILP objective value ➢ But optimal LP solution 𝑦∗ is not a binary vector
𝑦 without increasing the
min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ≥ 0, ∀𝑤 ∈ 𝑊 LP with real variables min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ∈ 0,1 , ∀𝑤 ∈ 𝑊 ILP with binary variables
373F19 - Nisarg Shah & Karan Singh 39
➢ Let ො
𝑦𝑤 = 1 whenever 𝑦𝑤
∗ ≥ 0.5 and ො
𝑦𝑤 = 0 otherwise
➢ Claim 1: ො
𝑦 is a feasible solution of ILP (i.e. a vertex cover)
∗, 𝑦𝑤 ∗ is at least 0.5
𝑦𝑣, ො 𝑦𝑤 is 1 ∎
min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ≥ 0, ∀𝑤 ∈ 𝑊 LP with real variables min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ∈ 0,1 , ∀𝑤 ∈ 𝑊 ILP with binary variables
373F19 - Nisarg Shah & Karan Singh 40
➢ Let ො
𝑦𝑤 = 1 whenever 𝑦𝑤
∗ ≥ 0.5 and ො
𝑦𝑤 = 0 otherwise
➢ Claim 2: σ𝑤 𝑥𝑤 ⋅ ො
𝑦𝑤 ≤ 2 ∗ σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤
∗
∗ ∈ [0.5,1] is shifted up to 1
min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ≥ 0, ∀𝑤 ∈ 𝑊 LP with real variables min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ∈ 0,1 , ∀𝑤 ∈ 𝑊 ILP with binary variables
373F19 - Nisarg Shah & Karan Singh 41
➢ Let ො
𝑦𝑤 = 1 whenever 𝑦𝑤
∗ ≥ 0.5 and ො
𝑦𝑤 = 0 otherwise
➢ Hence, ො
𝑦 is a vertex cover with weight at most 2 ∗ LP optimal value ≤ 2 ∗ ILP optimal value min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ≥ 0, ∀𝑤 ∈ 𝑊 LP with real variables min Σ𝑤 𝑥𝑤 ⋅ 𝑦𝑤 subject to 𝑦𝑣 + 𝑦𝑤 ≥ 1, ∀ 𝑣, 𝑤 ∈ 𝐹 𝑦𝑤 ∈ 0,1 , ∀𝑤 ∈ 𝑊 ILP with binary variables
373F19 - Nisarg Shah & Karan Singh 42
➢ Max 𝑑𝑈𝑦 subject to 𝐵𝑦 ≤ 𝑐, 𝑦 ∈ ℕ (need not be binary)
➢ Max 𝑑𝑈𝑦 subject to 𝐵𝑦 ≤ 𝑐, 𝑦 ∈ ℝ≥0 (LP relaxation)
➢ 𝑦∗ = LP optimal solution ➢ Round 𝑦∗ to ො
𝑑𝑈𝑦∗ 𝜍
ILP optimal value 𝜍
➢ Gives 𝜍-approximation
LP-ILP combination is called the integrality gap
373F19 - Nisarg Shah & Karan Singh 43
373F19 - Nisarg Shah & Karan Singh 44
➢ Input: Set of 𝑜 sites 𝑡1, … , 𝑡𝑜 and an integer 𝑙 ➢ Output: Return a set 𝐷 of 𝑙 centers s.t. the maximum
distance of any site from its nearest center is minimized
max
𝑗∈ 1,…,𝑜 𝑒(𝑡𝑗, 𝐷), where 𝑒 𝑡𝑗, 𝐷 = min 𝑑∈𝐷 𝑒 𝑡𝑗, 𝑑
➢ Sites are points in some metric space with distance 𝑒
satisfying:
373F19 - Nisarg Shah & Karan Singh 45
➢ Input: Set of 𝑜 sites 𝑡1, … , 𝑡𝑜 and an integer 𝑙 ➢ Output: Return a set 𝐷 of 𝑙 centers s.t. the maximum
distance of any site from its nearest center is minimized
max
𝑗∈ 1,…,𝑜 𝑒(𝑡𝑗, 𝐷), where 𝑒 𝑡𝑗, 𝐷 = min 𝑑∈𝐷 𝑒 𝑡𝑗, 𝑑
➢ Given 𝐷, note that 𝑠(𝐷) is the minimum radius 𝑠 such
that if we draw a ball of radius 𝑠 around every center in 𝐷, then the balls collectively cover all the sites
373F19 - Nisarg Shah & Karan Singh 46
Objective value
373F19 - Nisarg Shah & Karan Singh 47
➢ Put the first center at the optimal location for 𝑙 = 1 ➢ Put every next center to reduce the objective value as
much as possible given the centers already placed
373F19 - Nisarg Shah & Karan Singh 48
➢ Put the first center at an arbitrary site ➢ Put every next center at a site whose distance to its
nearest center is maximum among all sites
❑ Good Greedy ➢ 𝐷1 ← 𝑡1
(arbitrary site works)
➢ For 𝑘 = 2, … , 𝑙: ➢ 𝑡𝑗 ← argmax
𝑡
𝑒(𝑡, 𝐷
𝑘−1); Δ𝑘 = 𝑒 𝑡𝑗, 𝐷 𝑘−1
➢ 𝐷j ← 𝐷j−1 ∪ 𝑡𝑗 ➢ Return 𝐷k
373F19 - Nisarg Shah & Karan Singh 49
➢ Imagine that we run good greedy for 𝑙 + 1 steps rather
than 𝑙 steps, and obtain 𝐷𝑙+1
➢ Note: The 𝑙 + 1 points in 𝐷𝑙+1 are sites
❑
Good Greedy
➢ 𝐷1 ← 𝑡1
(arbitrary site works)
➢ For 𝑘 = 2, … , 𝑙: ➢ 𝑡𝑗 ← argmax
𝑡
𝑒(𝑡, 𝐷
𝑘−1); Δ𝑘 = 𝑒 𝑡𝑗, 𝐷 𝑘−1
➢ 𝐷j ← 𝐷j−1 ∪ 𝑡𝑗 ➢ Return 𝐷k
373F19 - Nisarg Shah & Karan Singh 50
𝑘 ≥ 𝑠 𝐷𝑙 for all 𝑡𝑗, 𝑡 𝑘 ∈ 𝐷𝑙+1
➢ Proof: By construction of the algorithm.
all previous centers
❑
Good Greedy
➢ 𝐷1 ← 𝑡1
(arbitrary site works)
➢ For 𝑘 = 2, … , 𝑙: ➢ 𝑡𝑗 ← argmax
𝑡
𝑒(𝑡, 𝐷
𝑘−1); Δ𝑘 = 𝑒 𝑡𝑗, 𝐷 𝑘−1
➢ 𝐷j ← 𝐷j−1 ∪ 𝑡𝑗 ➢ Return 𝐷k
373F19 - Nisarg Shah & Karan Singh 51
373F19 - Nisarg Shah & Karan Singh 52
373F19 - Nisarg Shah & Karan Singh 53
373F19 - Nisarg Shah & Karan Singh 54
373F19 - Nisarg Shah & Karan Singh 55
373F19 - Nisarg Shah & Karan Singh 56
➢ Draw a ball of radius 𝑠(𝐷∗) from each center in 𝐷∗ ➢ By pigeonhole principle, at least two 𝑡𝑗, 𝑡
𝑘 ∈ 𝐷𝑙+1 must
belong to the same ball (say centered at 𝑑∗ ∈ 𝐷∗)
𝑘, 𝑑∗ ≤ 𝑠 𝐷∗
➢ But by our claim:
𝑠 𝐷𝑙 ≤ 𝑒 𝑡𝑗, 𝑡
𝑘
≤ 𝑒 𝑡𝑗, 𝑑∗ + 𝑒 𝑡
𝑘, 𝑑∗ ≤ 2 ⋅ 𝑠 𝐷∗
➢ Done!
373F19 - Nisarg Shah & Karan Singh 57
➢ Good greedy gives 2-approximation in polynomial time ➢ Can we get a better approximation?
373F19 - Nisarg Shah & Karan Singh 58
➢ Same reduction idea:
center for some 𝜍 < 2, then using this algorithm, we can solve a known NP-complete problem in polytime.
373F19 - Nisarg Shah & Karan Singh 59
➢ Consider an instance of FriendlyRepresentatives
we want to check if there exists a subset 𝑇 ⊆ 𝑂 of 𝑛 people such that every person not in 𝑇 is friends with someone in 𝑇.
373F19 - Nisarg Shah & Karan Singh 60
➢ Consider an instance (𝑂, 𝐺, 𝑛) of FriendlyRepresentatives ➢ Create an instance of 𝑙-Center as follows
𝑘 = 1 if 𝑗, 𝑘 ∈ 𝐺 and 2 if 𝑗, 𝑘 ∉ 𝐺
place centers on sites.
373F19 - Nisarg Shah & Karan Singh 61
➢ 𝐷 is a set of friendly representatives if and only if 𝑠 𝐷 = 1
𝑘 is at distance at most 1 from some 𝑡𝑗 ∈ 𝐷 if and
➢ There are only two possibilities:
373F19 - Nisarg Shah & Karan Singh 62
➢ YES: There exists 𝐷 with 𝑠 𝐷 = 1
return a set 𝐷 with 𝑠 𝐷 < 2
➢ NO: Our algorithm returns a 𝐷 with 𝑠 𝐷 = 2 ➢ So checking 𝑠(𝐷) of the 𝐷 returned by algorithm allows
solving FriendlyRepresentatives!
373F19 - Nisarg Shah & Karan Singh 63
373F19 - Nisarg Shah & Karan Singh 64
➢ Input: A collection of sets 𝒯 = 𝑇1, … , 𝑇𝑜 with values
𝑤1, … , 𝑤𝑜 ≥ 0. There are m set elements.
➢ Output: Pick disjoint sets with maximum total value, i.e.
𝑘 = ∅.
➢ This is known to be an NP-hard problem ➢ It is also known that for any constant 𝜗 > 0, you cannot
get 𝑃 𝑛 Τ
1 2−𝜗 approximation in polynomial time unless
NP=ZPP (widely believed to be not true)
CSC304 - Nisarg Shah 65
➢ Sort the sets in a specific order. ➢ Relabel them as 1,2, … , 𝑜 in this order. ➢ 𝑋 ← ∅ ➢ For 𝑗 = 1, … , 𝑜:
𝑘 = ∅ for every 𝑘 ∈ 𝑋, then 𝑋 ← 𝑋 ∪ {𝑗}
➢ Return 𝑋.
CSC304 - Nisarg Shah 66
➢ 𝑤1 ≥ 𝑤2 ≥ ⋯ ≥ 𝑤𝑜? Only 𝑛-approximation
➢
𝑤1 𝑇1 ≥ 𝑤2 𝑇2 ≥ ⋯ 𝑤𝑜 𝑇𝑜 ? Also 𝑛-approximation
𝑤1 𝑇1 ≥ 𝑤2 𝑇2 ≥ ⋯ 𝑤𝑜 𝑇𝑜 ? [Lehmann et al. 2011]
CSC2556 - Nisarg Shah 67
➢ 𝑃𝑄𝑈 = Some optimal solution ➢ 𝑋 = Solution returned by our greedy algorithm ➢ For 𝑗 ∈ 𝑋,
𝑃𝑄𝑈𝑗 = 𝑘 ∈ 𝑃𝑄𝑈, 𝑘 ≥ 𝑗 ∶ 𝑇𝑗 ∩ 𝑇
𝑘 ≠ ∅
OPTi has future j in OPT blocked for inclusion in greedy W because of choosing I (i is also in OPTi).
If j from OPT is in W => j in OPTj, else j must be in some OPTi or the greedy algorithm would have chosen it.
The value of greedy choice i is at least as good 1/ 𝑛 * the values from the optimal solution it blocks, and all elements of OPT will be accounted for by the union of OPTi’s.
𝑇𝑘 𝑇𝑗
Greedy ordering.
CSC2556 - Nisarg Shah 68
𝑘
2 ⋅
2)
𝑘 ≤
𝑘
Every element in Si can block at most one set in OPT => OPTi <= Si. Also note every Sj in OPTi is disjoint because it belongs to OPT. so the sum of these Sj’s is at most m.
373F19 - Nisarg Shah & Karan Singh 69
373F19 - Nisarg Shah & Karan Singh 70
➢ Sometimes it might provably return an optimal solution ➢ But even if not, it might give a good approximation
➢ Start with some solution 𝑇 ➢ While there is a “better” solution 𝑇′ in the local neighborhood of 𝑇 ➢
Switch to 𝑇’
373F19 - Nisarg Shah & Karan Singh 71
➢ Start with zero flow ➢ “Local neighborhood”
flow along a path in the residual graph
➢ “Better”
373F19 - Nisarg Shah & Karan Singh 72
373F19 - Nisarg Shah & Karan Singh 73
Worst ratio
373F19 - Nisarg Shah & Karan Singh 74
373F19 - Nisarg Shah & Karan Singh 75
➢ Input: An undirected graph 𝐻 = (𝑊, 𝐹) ➢ Output: A partition (𝐵, 𝐶) of 𝑊 that maximizes the
number of edges going across the cut, i.e., maximizes |𝐹′| where 𝐹′ = 𝑣, 𝑤 ∈ 𝐹 𝑣 ∈ 𝐵, 𝑤 ∈ 𝐶}
➢ This is also known to be an NP-hard problem ➢ What is a natural local search algorithm for this problem?
improve the objective value?
373F19 - Nisarg Shah & Karan Singh 76
➢ Initialize (𝐵, 𝐶) arbitrarily. ➢ While there is a vertex 𝑣 such that moving 𝑣 to the other
side improves the objective value:
➢ When does moving 𝑣, say from 𝐵 to 𝐶, improve the
the cut, i.e., when 𝑣, 𝑤 ∈ 𝐹 𝑤 ∈ 𝐵 > 𝑣, 𝑤 ∈ 𝐹 𝑤 ∈ 𝐶
373F19 - Nisarg Shah & Karan Singh 77
➢ Initialize (𝐵, 𝐶) arbitrarily. ➢ While there is a vertex 𝑣 such that moving 𝑣 to the other
side improves the objective value:
➢ Why does the algorithm stop?
least 1, so the algorithm must stop in at most |𝐹| iterations
373F19 - Nisarg Shah & Karan Singh 78
➢ Initialize (𝐵, 𝐶) arbitrarily. ➢ While there is a vertex 𝑣 such that moving 𝑣 to the other
side improves the objective value:
➢ Approximation ratio?
the cut as within the cut
373F19 - Nisarg Shah & Karan Singh 79
➢ Now we’re given integral edge weights 𝑥: 𝐹 → ℕ ➢ The goal is to maximize the total weight of edges going
across the cut
➢ The same algorithm works, but now we move 𝑣 to the
within the cut is greater than the total weight of its incident edges going across the cut
373F19 - Nisarg Shah & Karan Singh 80
➢ In the unweighted case, we said that the number of
edges going across the cut must increase by at least 1, so it takes at most |𝐹| iterations
➢ In the weighted case, the total weight of edges going
across the cut increases by at least 1, but this could take up to σ𝑓∈𝐹 𝑥𝑓 iterations, which is exponential in the input length
exponentially many steps
373F19 - Nisarg Shah & Karan Singh 81
➢ But we can find a 2 + 𝜗 approximation in time polynomial
in the input length and
1 𝜗
➢ The idea is to only move vertices when it “sufficiently
improves” the objective value
373F19 - Nisarg Shah & Karan Singh 82
➢ Theorem [Goemans-Williamson]: There exists a
polynomial time algorithm for max-cut with approximation ratio
2 𝜌 ⋅ min 0≤𝜄≤𝜌 𝜄 1−cos 𝜄 ≈ 0.878
so we will follow that convention in the remaining slides.
➢ If the unique games conjecture is true, then this is tight
373F19 - Nisarg Shah & Karan Singh 83
373F19 - Nisarg Shah & Karan Singh 84
➢ Input: An exact 𝑙-SAT formula 𝜒 = 𝐷1 ∧ 𝐷2 ∧ ⋯ ∧ 𝐷𝑛,
where each clause 𝐷𝑗 has exactly 𝑙 literals, and a weight 𝑥𝑗 ≥ 0 of each clause 𝐷𝑗
➢ Output: A truth assignment 𝜐 maximizing the number (or
total weight) of clauses satisfied under 𝜐
➢ Let us denote by 𝑋(𝜐) the total weight of clauses
➢ What is a good definition of “local neighborhood”?
373F19 - Nisarg Shah & Karan Singh 85
➢ 𝑂𝑒(𝜐) = set of all truth assignments which can be
2 3
373F19 - Nisarg Shah & Karan Singh 86
2 3
➢ Let 𝜐 be a local optimum
2 3 ⋅ 𝑋 𝑇0 + 𝑋 𝑇1 + 𝑋 𝑇2
1 3 ⋅ 𝑋 𝑇0 + 𝑋 𝑇1 + 𝑋 𝑇2
373F19 - Nisarg Shah & Karan Singh 87
2 3
➢ Let 𝜐 be a local optimum
2 3 ⋅ 𝑋 𝑇0 + 𝑋 𝑇1 + 𝑋 𝑇2
1 3 ⋅ 𝑋 𝑇0 + 𝑋 𝑇1 + 𝑋 𝑇2
373F19 - Nisarg Shah & Karan Singh 88
2 3
➢ Clause 𝐷 involves variable 𝑘 if it contains 𝑦𝑘 or ഥ
𝑘 = set of clauses in 𝑇1 involving variable 𝑘 such that it is the
literal of variable 𝑘 that is true under 𝜐
𝑘 = set of clauses in 𝑇2 involving variable 𝑘
𝑘 , 𝑋 𝐷 𝑘 be the corresponding total weights
373F19 - Nisarg Shah & Karan Singh 89
2 3
➢ 2 𝑋 𝑇0 = σ𝑘 𝑋 𝐵𝑘
➢ 𝑋 𝑇1 = σ𝑘 𝑋 𝐶
𝑘
whose literal was true under 𝜐
➢ For each 𝑘 : 𝑋 𝐵𝑘 ≤ 𝑋 𝐶
𝑘
373F19 - Nisarg Shah & Karan Singh 90
2 3
➢ 2 𝑋 𝑇0 ≤ 𝑋 𝑇1
using the first two equations on the last slide
➢ Hence:
373F19 - Nisarg Shah & Karan Singh 91
➢ Searches over a larger neighborhood ➢ May get a better approximation ratio, but increases the
running time as we now need to check if any neighbor in a large neighborhood provides a better objective
➢ The bound is still 2/3 for 𝑒 = 𝑝(𝑜) ➢ It is no better than 4/5 for 𝑒 < Τ
𝑜 2
➢ It can be shown that with 𝑒 = Τ
𝑜 2, the algorithm always
terminates at an optimal solution
373F19 - Nisarg Shah & Karan Singh 92
➢ We can learn something from our proof ➢ Note that we did not use anything about 𝑋 𝑇2 , and
simply added it at the end
➢ If we could also guarantee that 𝑋 𝑇0 ≤ 𝑋 𝑇2 …
would give a Τ
3 4 approximation
➢ Result (without proof): This can be done by including just
𝑂1 𝜐 ∪ 𝜐𝑑 , where 𝜐𝑑 = complement of 𝜐
373F19 - Nisarg Shah & Karan Singh 93
➢ A slightly different tweak also works ➢ We want to weigh clauses in 𝑋(𝑇2) more because when
➢ Start at arbitrary 𝜐 ➢ While there is an assignment in 𝑂1 𝜐 that improves the
potential 1.5 𝑋 𝑇1 + 2 𝑋(𝑇2)
373F19 - Nisarg Shah & Karan Singh 94
➢ Start at arbitrary 𝜐 ➢ While there is an assignment in 𝑂1 𝜐 that improves the
potential 1.5 𝑋 𝑇1 + 2 𝑋(𝑇2)
➢ This is the first time that we’re using a definition of
“better” in local search paradigm that does not quite align with the ultimate objective we want to maximize
➢ This is called “non-oblivious local search”
373F19 - Nisarg Shah & Karan Singh 95
➢ Start at arbitrary 𝜐 ➢ While there is an assignment in 𝑂1 𝜐 that improves the
potential 1.5 𝑋 𝑇1 + 2 𝑋(𝑇2)
➢ Modified local search gives Τ
3 4-approximation to Exact
Max-2-SAT
373F19 - Nisarg Shah & Karan Singh 96
➢ The same technique works for higher values of 𝑙 ➢ Gives
2𝑙−1 2𝑙 approximation for Exact Max-𝑙-SAT
simpler technique
7 8 for Exact Max-3-SAT
➢ Theorem [Håstad]: Achieving Τ
7 8 + 𝜗 approximation
where 𝜗 > 0 is NP-hard.