MCS 312: NP Completeness and Approximation algorthms

Slides:



Advertisements
Similar presentations
Approximation algorithms for geometric intersection graphs.
Advertisements

MCA 301: Design and Analysis of Algorithms
Instructor Neelima Gupta Table of Contents Approximation Algorithms.
Approximation Algorithms
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Instructor Neelima Gupta Table of Contents Greedy Algorithms.
PTAS for Bin-Packing. Special Cases of Bin Packing 1. All item sizes smaller than Claim 1: Proof: If then So assume Therefore:
Complexity 16-1 Complexity Andrei Bulatov Non-Approximability.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Instructor Neelima Gupta Table of Contents Lp –rounding Dual Fitting LP-Duality.
CSC401 – Analysis of Algorithms Lecture Notes 12 Dynamic Programming
Polynomial time approximation scheme Lecture 17: Mar 13.
Computability and Complexity 24-1 Computability and Complexity Andrei Bulatov Approximation.
Dynamic Programming 0-1 Knapsack These notes are taken from the notes by Dr. Steve Goddard at
1 Approximation Through Scaling Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
Approximation Algorithms for Knapsack Problems 1 Tsvi Kopelowitz Modified by Ariel Rosenfeld.
Chapter 15 Approximation Algorithm Introduction Basic Definition Difference Bounds Relative Performance Bounds Polynomial approximation Schemes Fully Polynomial.
MCA 202: Discrete Structures Instructor Neelima Gupta
Instructor Neelima Gupta Table of Contents Class NP Class NPC Approximation Algorithms.
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
Instructor Neelima Gupta Table of Contents Factor 2 algorithm for Bin Packing Factor 2 algorithm for Minimum Makespan Scheduling Reference:
Instructor Neelima Gupta Table of Contents Five representative problems.
MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta
Lecture.6. Table of Contents Lp –rounding Dual Fitting LP-Duality.
Instructor Neelima Gupta Instructor: Ms. Neelima Gupta.
Introduction to NP Instructor: Neelima Gupta 1.
1 The instructor will be absent on March 29 th. The class resumes on March 31 st.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
MCS 312: NP Completeness and Approximation Algorithms Instructor Neelima Gupta
Instructor Neelima Gupta Table of Contents Introduction to Approximation Algorithms Factor 2 approximation algorithm for TSP Factor.
Approximation algorithms
Design and Analysis of Approximation Algorithms
Chapter 10 NP-Complete Problems.
Approximating Set Cover
8.3.2 Constant Distance Approximations
Mathematical Foundations of AI
Approximation Algorithms
Greedy Method 6/22/2018 6:57 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Approximation Algorithms
Hard Problems Introduction to NP
Approximation algorithms
Approximation Algorithms
Approximation Algorithms
Computability and Complexity
Which type of claim does this represent?
Which type of claim does this represent?
The Subset Sum Game Revisited
Bin Fu Department of Computer Science
Merge Sort 11/28/2018 2:18 AM The Greedy Method The Greedy Method.
Merge Sort 11/28/2018 8:16 AM The Greedy Method The Greedy Method.
Appropriate algorithms for Generalized Maximum Coverage
MCA 301: Design and Analysis of Algorithms
Approximation Algorithms
PTAS for Bin-Packing.
Merge Sort 1/17/2019 3:11 AM The Greedy Method The Greedy Method.
Polynomial time approximation scheme
Dynamic Programming Dynamic Programming 1/18/ :45 AM
Merge Sort 1/18/ :45 AM Dynamic Programming Dynamic Programming.
Dynamic Programming Merge Sort 1/18/ :45 AM Spring 2007
Merge Sort 2/22/ :33 AM Dynamic Programming Dynamic Programming.
Instructor Neelima Gupta
Advanced LP models column generation.
Advanced LP models column generation.
Lecture 4 Dynamic Programming
Merge Sort 4/28/ :13 AM Dynamic Programming Dynamic Programming.
Merge Sort 5/2/2019 7:53 PM The Greedy Method The Greedy Method.
Lecture 5 Dynamic Programming
Dynamic Programming Merge Sort 5/23/2019 6:18 PM Spring 2008
Instructor: Aaron Roth
ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS
Presentation transcript:

MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta ngupta@cs.du.ac.in

Table of Contents FPTAS for the Knapsack Problem Reference: Vazirani.

Definition Given a set {a1, a2 . . . an} of n objects with profit p(ai) and size s(ai). And, a knapsack with capacity B. Find a collection of objects fitting into the knapsack that maximizes the profit.

Pseudo Polynomial Algorithms

Pseudo Polynomial for KS Let P = max { p(ai) } Let S(i, p) denotes a subset of {a1, a2 . . . ai} with profit exactly equal to p that minimizes the size. Let A(i,p) denotes the size of S(i, p). A(i,p) = infinity if no such set exists. A(1,p) is easy to compute (in fact known directly) for every p in {1 … nP} A(i+1,p) = min{ A(i, p), size (ai+1, p – p(ai+1) } if p(ai) < p = A(i, p) otherwise

Example n = 4 B = 5 Elements (size, profit): (2,3), (3,4), (4,5), (5,6) Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

(2,3), (3,4), (4,5), (5,6) W 0 1 2 3 4 5 i 1 2 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w1 ; m[1,1] = m[1-1,1] = m[0,1] (2,3), (3,4), (4,5), (5,6) As w<w1 ; m[1,1] = m[1-1,1] = m[0,1] W 0 1 2 3 4 5 i 1 2 3 4 inf 2 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w2 ; m[2,1] = m[2-1,1] = m[1,1] (2,3), (3,4), (4,5), (5,6) As w<w2 ; m[2,1] = m[2-1,1] = m[1,1] W 0 1 2 3 4 5 i 1 2 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w3 ; m[3,1] = m[3-1,1] = m[2,1] (2,3), (3,4), (4,5), (5,6) As w<w3 ; m[3,1] = m[3-1,1] = m[2,1] W 0 1 2 3 4 5 i 1 2 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w4 ; m[4,1] = m[4-1,1] = m[3,1] (2,3), (3,4), (4,5), (5,6) As w<w4 ; m[4,1] = m[4-1,1] = m[3,1] W 0 1 2 3 4 5 i 1 2 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w1 ; m[1,2] = max{m[1-1,2] , m[1-1,2-2]+3} =max{ 0,0+3} (2,3), (3,4), (4,5), (5,6) As w>=w1 ; m[1,2] = max{m[1-1,2] , m[1-1,2-2]+3} =max{ 0,0+3} W 0 1 2 3 4 5 i 1 2 3 4 3 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w2 ; m[2,2] = m[2-1,2] = m[1,2] (2,3), (3,4), (4,5), (5,6) As w<w2 ; m[2,2] = m[2-1,2] = m[1,2] W 0 1 2 3 4 5 i 1 2 3 4 3 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w3 ; m[3,2] = m[3-1,2] = m[2,2] (2,3), (3,4), (4,5), (5,6) As w<w3 ; m[3,2] = m[3-1,2] = m[2,2] W 0 1 2 3 4 5 i 1 2 3 4 3 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w4 ; m[4,2] = m[4-1,2] = m[3,2] (2,3), (3,4), (4,5), (5,6) As w<w4 ; m[4,2] = m[4-1,2] = m[3,2] W 0 1 2 3 4 5 i 1 2 3 4 3 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w1 ; m[1,3] = max{m[1-1,3] , m[1-1,3-2]+3} =max{ 0,0+3} (2,3), (3,4), (4,5), (5,6) As w>=w1 ; m[1,3] = max{m[1-1,3] , m[1-1,3-2]+3} =max{ 0,0+3} W 0 1 2 3 4 5 i 1 2 3 4 3 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w2 ; m[2,3] = max{m[2-1,3] , m[2-1,3-3]+4} =max{ 3,0+4} (2,3), (3,4), (4,5), (5,6) As w>=w2 ; m[2,3] = max{m[2-1,3] , m[2-1,3-3]+4} =max{ 3,0+4} W 0 1 2 3 4 5 i 1 2 3 4 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w3 ; m[3,3] = m[3-1,3] = m[2,3] (2,3), (3,4), (4,5), (5,6) As w<w3 ; m[3,3] = m[3-1,3] = m[2,3] W 0 1 2 3 4 5 i 1 2 3 4 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w4 ; m[4,3] = m[4-1,3] = m[3,3] (2,3), (3,4), (4,5), (5,6) As w<w4 ; m[4,3] = m[4-1,3] = m[3,3] W 0 1 2 3 4 5 i 1 2 3 4 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w1 ; m[1,4] = max{m[1-1,4] , m[1-1,4-2]+3} =max{ 0,0+3} (2,3), (3,4), (4,5), (5,6) As w>=w1 ; m[1,4] = max{m[1-1,4] , m[1-1,4-2]+3} =max{ 0,0+3} W 0 1 2 3 4 5 i 1 2 3 4 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w2 ; m[2,4] = max{m[2-1,4] , m[2-1,4-3]+4} =max{ 3,0+4} (2,3), (3,4), (4,5), (5,6) As w>=w2 ; m[2,4] = max{m[2-1,4] , m[2-1,4-3]+4} =max{ 3,0+4} W 0 1 2 3 4 5 i 1 2 3 4 3 4 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w3 ; m[3,4] = max{m[3-1,4] , m[3-1,4-4]+5} =max{ 4,0+5} (2,3), (3,4), (4,5), (5,6) As w>=w3 ; m[3,4] = max{m[3-1,4] , m[3-1,4-4]+5} =max{ 4,0+5} W 0 1 2 3 4 5 i 1 2 3 4 3 4 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w<w4 ; m[4,4] = m[4-1,4] = m[3,4] (2,3), (3,4), (4,5), (5,6) As w<w4 ; m[4,4] = m[4-1,4] = m[3,4] W 0 1 2 3 4 5 i 1 2 3 4 3 4 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w1 ; m[1,5] = max{m[1-1,5] , m[1-1,5-2]+3} =max{ 0,0+3} (2,3), (3,4), (4,5), (5,6) As w>=w1 ; m[1,5] = max{m[1-1,5] , m[1-1,5-2]+3} =max{ 0,0+3} W 0 1 2 3 4 5 i 1 2 3 4 3 4 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w2 ; m[2,5] = max{m[2-1,5] , m[2-1,5-3]+4} =max{ 3,3+4} (2,3), (3,4), (4,5), (5,6) As w>=w2 ; m[2,5] = max{m[2-1,5] , m[2-1,5-3]+4} =max{ 3,3+4} W 0 1 2 3 4 5 i 1 2 3 4 3 4 7 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w3 ; m[3,5] = max{m[3-1,5] , m[3-1,5-4]+5} =max{ 7,0+5} (2,3), (3,4), (4,5), (5,6) As w>=w3 ; m[3,5] = max{m[3-1,5] , m[3-1,5-4]+5} =max{ 7,0+5} W 0 1 2 3 4 5 i 1 2 3 4 3 4 7 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

As w>=w4 ; m[4,5] = max{m[4-1,5] , m[4-1,5-5]+6} =max{ 7,0+6} (2,3), (3,4), (4,5), (5,6) As w>=w4 ; m[4,5] = max{m[4-1,5] , m[4-1,5-5]+6} =max{ 7,0+6} W 0 1 2 3 4 5 i 1 2 3 4 3 4 7 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

(2,3), (3,4), (4,5), (5,6) W 0 1 2 3 4 5 i 1 2 3 4 3 4 7 5 Thanks to : Neha Katyal (17, MCS '11), Shikha Walia (27, MCS'11)

FPTAS Given \epsilon, let k = \epsilon P /n Let p’(a) = floor (p(a)/k) Find an optimal solution, say S’, using DP with these profits. Output S’ Claim: p(S’) >= (1-\epsilon) OPT

kp’(a) <= p(a) p’(a) = floor (p(a)/k) >= p(a)/k - 1. Thus, kp’(a) >= p(a) - k i.e. p(a) - kp’(a) <= k i.e. k p’(a) >= p(a) - k Let O be an optimal solution. The O is a solution for the problem with the new profits as well. Thus, p’(S’) >= p’(O) Thus, p(S) >= k p’(S’) >= kp’(O) >= p(O) – k|O| >= p(O) – kn = OPT - \epsilon P >= (1 - \epsilon) OPT (as OPT <= P)

Running Time O(n^2 P’) = O(n^2 floor(P/k)) = O(n^2 floor(n/\epsilon)) Which is polynomial in n and \epsilon.

Thank You! Consolidated by: Sumedha Upadhyaya( 42), Prachi Nagpal(41) (MCS '09)