SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Approximation
   Algorithms

           presented by
       Nicolas Bettenburg



                            1
Many problems with practical signiïŹcance
are NP-complete.


                 Unlikely to ïŹnd a polynomial-time
                   solution algorithm (nobody knows).




                                                        2
Work around NP
 completeness

 ‱ Small Inputs: stay with exponential
  algorithm!

 ‱ Often special cases are solvable in
  polynomial time.

 ‱ Find a near-optimal solution in
  polynomial time that is good enough.



                                         3
Approximation Algorithms


‱ For a lot of practical applications near-optimal
 solutions are perfectly acceptable.

‱ Algorithms that return near-optimal solutions for a
 problem are called approximation algorithms.

‱ Want to study polynomial time approximation
 algorithms for NP-complete problems.


                                                        4
What is ‘’good enough’’?

 For an approximation algorithm A
 of input of size n
 the cost of solution produced by A is C


    Approximation Ratio of A is p(n)
                C C∗
         max       ,
                  ∗ C
                         ≀ p(n)
                C

                                           5
An approximation algorithm with ratio p(n)
is called a p(n)-approximation algorithm.




                                                6
List of 21 Problems
that are NP-complete
Richard Karp, 1972

       .
       .
       .
   ‱ CLIQUE
   ‱ SET PACKING
   ‱ VERTEX COVER
   ‱ SET COVERING
   ‱ FEEDBACK NODE SET
   ‱ FEEDBACK ARC SET
   ‱ KNAPSACK
   ‱ PARTITION
   ‱ MAX-CUT
       .
       .
       .
                         7
Vertex Cover Problem




                       8
Vertex Cover
a subset U of all vertices V, such
that every edge in E is covered.


         b            c              d



          a           e              f          g



Covered Edge
an edge e = (vi, vj) is covered if ei or ej is chosen.

                                                         9
Minimum Vertex Cover
         Problem

Input: a Graph G = (V, E)

Output: the smallest subset U ⊆ V
                   such that ∀e = (vi , vj ) ∈ E, i = j
                                 vi ∈ U   or   vj ∈ U




                                                          10
b   c              d



a   e              f   g




        Input: G


                           11
b   c   d



a   e   f   g




                12
b   c   d



a   e   f   g




                13
b       c          d



a       e          f        g




    Output: C = {b, d, e}


                                14
Greedy-Vertex-Cover(G)
1 C = {}
2     do chose v in V with max deg
3        C = C + {v}
4        remove v and every edge
5        adjacent to v
6     until all edges covered
7 return C



                                     15
b   c   d



a   e   f   g




                16
b   c   d



a   e   f   g




                17
b        c          d



a        e          f         g



    3 possible choices here
    determines the outcome

                                  18
b   c   d



a   e   f   g




                19
b   c   d



a   e   f   g




                20
b           c          d



a           e          f            g



    Goodness of solution depends
    on the (random) choices made.

                                        21
Approx-Vertex-Cover(G)
1    C = {}
2    E’ = E[G]
3    while E’ != {}
4       do let (u,v) be some e in E’
5           C = C + {u, v}
6          remove from E’ every edge
7          incident to either u or v
8       end do
9    end while
10   return C

                                       22
Approx-Vertex-Cover(G)
1    C = {}
2    E’ = E[G]
3    while E’ != {}
4       do let (u,v) be some e in E’
5           C = C + {u, v}
6          remove from E’ every edge
7          incident to either u or v
8       end do
9    end while
10   return C                 O(|V | + |E|)

                                              23
b             c            d



       a             e             f            g




C = {}
E = {(a-b), (b-c), (c-e), (c-d),(e-f),(e-d), (f-d), (d-g)}
                                                             24
b             c            d



      a             e             f            g




C = {}
E = {(a-b), (b-c), (c-e), (c-d),(e-f),(e-d), (f-d), (d-g)}
                                                             25
b             c             d



       a            e             f   g




C = {b, c}
E = {(e-f),(e-d), (f-d), (d-g)}
                                          26
b            c              d



      a            e              f   g




C = {b, c}
E = {(e-f),(e-d), (f-d), (d-g)}
                                          27
b           c   d



       a           e   f   g




C = {b, c, e, f}
E = {(d-g)}
                               28
b           c   d



       a           e   f   g




C = {b, c, e, f}
E = {(d-g)}
                               29
b             c   d



       a             e   f   g




C = {b, c, e, f, d, g}
E = {}
                                 30
C = {b, c, e, f, d, g}
|C| = 6 = 2 · 3 ≀ 2 · |C ∗ |
the algorithm found a 2-approximation.


  b              c             d



  a              e             f   g




                                         31
Approx-Vertex-Cover(G)

1    C = {}
2    E’ = E[G]
3    while E’ != {}
4       do let (u,v) be some e in E’
5           C = C + {u, v}
6          remove from E’ every edge
7          incident to either u or v
8       end do
9    end while
10   return C




             C is a vertex cover of G
             Proof:
              The algorithm loops until every edge in E’ = E[G] has been
              covered (removed) by some vertex in C.




                                                                           32
Approx-Vertex-Cover(G)

1    C = {}
2    E’ = E[G]
3    while E’ != {}
4       do let (u,v) be some e in E’
5           C = C + {u, v}
6          remove from E’ every edge
7          incident to either u or v
8       end do
9    end while
10   return C




             C is at most 2 times C*
             Proof:
              Let A be the set of edges picked by algorithm step 4. C*
              must include at least one endpoint of each edge in set A. No
              two edges share an endpoint, since all adjacent edges are
              deleted after picking in line 6. Thus no two edges in A are
              covered by the same vertex in C*.


                                       |C ∗ | ≄ |A|

                                                                             33
Approx-Vertex-Cover(G)

1    C = {}
2    E’ = E[G]
3    while E’ != {}
4       do let (u,v) be some e in E’
5           C = C + {u, v}
6          remove from E’ every edge
7          incident to either u or v
8       end do
9    end while
10   return C




             C is at most 2 times C*
             Proof:
              Each execution of line 4 picks an edge for which neither of
              the endpoints are in C already.



                                       |C| = 2 · |A|
                                       |C ∗ | ≄ |A|

                                                                            34
Can we do better?




                    35
Maximal Matching


      b          c          d



      a          e          f         g


Input:  a graph G=(V, E)
Output: a maximal subset E’ of E, such that
        no two edges share a common
        vertex.
                                              36
The approximation algorithm
produces a maximal matching




                          37
Alternative Formulation
     of Vertex Cover

     b          c         d



     a          e         f         g



Input:  a graph G=(V, E)
Output: the endpoints of a maximal matching

                                              38
In Bipartite Graphs:

Maximal Matching = Minimal Vertex Cover

         Stated as König’s Theorem in 1914,
                  proven in 1916.




                                              39
Complete bipartite Graph with n vertices
                                           40
Is a tight example, has maximal matching of n.
                                                 41
Hence |C| = 2n. So 2 is a tight bound!
                                         42
No better algorithm than the 2-approximation
  algorithm for computing the vertex cover
     in polynomial time is known so far.




                                               43
A parallel algorithm to compute the 2-approximate
        minimum vertex cover in O(log3|E|)
with O(|V|+|E|) processors was discovered in 2006.


                                                     44
Set Cover Problem




                    45
The Set Cover Problem


Input:    a ïŹnite Set X
Output: a family F of subsets of X,
        such that every element of X
        belongs to at least one subset in F: X = âˆȘS∈F S




                                                      46
Set X


S1


          S4      S2

          S6
    S3                S5
Subsets S1, S2, S3, S4, S5, S6


                                 47
Set X


  S1


          S4     S2

          S6
      S3           S5
Minimum-Size Cover: S3, S4, S5


                                 48
Greedy-Set-Cover(G)
1 U = X
2 C = {}
3     while U != {} do
4        select an S in F
5        that maximizes |S ∩U|
6        U = U-S
7        C = C âˆȘ{S}
8     end while
9 return C
                       O(|X| · |F |)

                                       49
Greedy-Set-Cover is an
(ln |X|+1)-approximation algorithm.




                                      50
Can we do better?




                    51
Open research
  question



                52
Discussion




             53

Weitere Àhnliche Inhalte

Was ist angesagt?

Backtracking & branch and bound
Backtracking & branch and boundBacktracking & branch and bound
Backtracking & branch and boundVipul Chauhan
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemMadhu Bala
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmsRajendran
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithmMohd Arif
 
Approximation algorithms
Approximation algorithmsApproximation algorithms
Approximation algorithmsGanesh Solanke
 
And or graph
And or graphAnd or graph
And or graphAli A Jalil
 
simple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonsimple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonkanikkk
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy AlgorithmsAmrinder Arora
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest pathArafat Hossan
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityBhavin Darji
 

Was ist angesagt? (20)

Backtracking & branch and bound
Backtracking & branch and boundBacktracking & branch and bound
Backtracking & branch and bound
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Dynamic pgmming
Dynamic pgmmingDynamic pgmming
Dynamic pgmming
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
 
Approximation algorithms
Approximation algorithmsApproximation algorithms
Approximation algorithms
 
And or graph
And or graphAnd or graph
And or graph
 
simple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonsimple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilon
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Approximation Algorithms TSP
 
Unit 3 daa
Unit 3 daaUnit 3 daa
Unit 3 daa
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 
Hill climbing
Hill climbingHill climbing
Hill climbing
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of Optimality
 

Ähnlich wie Approximation Algorithms

Solution manual 9
Solution manual 9Solution manual 9
Solution manual 9Rafi Flydarkzz
 
Complex analysis notes
Complex analysis notesComplex analysis notes
Complex analysis notesPrakash Dabhi
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph MotifAMR koura
 
Escola naval 2015
Escola naval 2015Escola naval 2015
Escola naval 2015KalculosOnline
 
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...seijihagawa
 
1452 86301000013 m
1452 86301000013 m1452 86301000013 m
1452 86301000013 mPraveen Kumar
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_PresentationAnna Lasota
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph AJAL A J
 
New Families of Odd Harmonious Graphs
New Families of Odd Harmonious GraphsNew Families of Odd Harmonious Graphs
New Families of Odd Harmonious GraphsIJMIT JOURNAL
 
Vertex cover Problem
Vertex cover ProblemVertex cover Problem
Vertex cover ProblemGajanand Sharma
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning treeAmit Kumar Rathi
 
Important Cuts and (p,q)-clustering
Important Cuts and (p,q)-clusteringImportant Cuts and (p,q)-clustering
Important Cuts and (p,q)-clusteringASPAK2014
 
10.1.1.226.4381
10.1.1.226.438110.1.1.226.4381
10.1.1.226.4381prakashpvms
 
Complex Analysis And ita real life problems solution
Complex Analysis And ita real life problems solutionComplex Analysis And ita real life problems solution
Complex Analysis And ita real life problems solutionNaeemAhmad289736
 
10.1.1.92.3502
10.1.1.92.350210.1.1.92.3502
10.1.1.92.3502wildanowitzki
 

Ähnlich wie Approximation Algorithms (20)

Solution manual 9
Solution manual 9Solution manual 9
Solution manual 9
 
Complex analysis notes
Complex analysis notesComplex analysis notes
Complex analysis notes
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph Motif
 
Escola naval 2015
Escola naval 2015Escola naval 2015
Escola naval 2015
 
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
Scalable Global Alignment Graph Kernel Using Random Features: From Node Embed...
 
Topological Sort
Topological SortTopological Sort
Topological Sort
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Efoom 2020
Efoom 2020Efoom 2020
Efoom 2020
 
1452 86301000013 m
1452 86301000013 m1452 86301000013 m
1452 86301000013 m
 
MinFill_Presentation
MinFill_PresentationMinFill_Presentation
MinFill_Presentation
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph
 
New Families of Odd Harmonious Graphs
New Families of Odd Harmonious GraphsNew Families of Odd Harmonious Graphs
New Families of Odd Harmonious Graphs
 
Vertex cover Problem
Vertex cover ProblemVertex cover Problem
Vertex cover Problem
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Important Cuts and (p,q)-clustering
Important Cuts and (p,q)-clusteringImportant Cuts and (p,q)-clustering
Important Cuts and (p,q)-clustering
 
10.1.1.226.4381
10.1.1.226.438110.1.1.226.4381
10.1.1.226.4381
 
Complex Analysis And ita real life problems solution
Complex Analysis And ita real life problems solutionComplex Analysis And ita real life problems solution
Complex Analysis And ita real life problems solution
 
Isograph
IsographIsograph
Isograph
 
10.1.1.92.3502
10.1.1.92.350210.1.1.92.3502
10.1.1.92.3502
 
Chapter 03 drill_solution
Chapter 03 drill_solutionChapter 03 drill_solution
Chapter 03 drill_solution
 

Mehr von Nicolas Bettenburg

10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...
10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...
10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...Nicolas Bettenburg
 
Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...
Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...
Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...Nicolas Bettenburg
 
Think Locally, Act Gobally - Improving Defect and Effort Prediction Models
Think Locally, Act Gobally - Improving Defect and Effort Prediction ModelsThink Locally, Act Gobally - Improving Defect and Effort Prediction Models
Think Locally, Act Gobally - Improving Defect and Effort Prediction ModelsNicolas Bettenburg
 
Mining Development Repositories to Study the Impact of Collaboration on Softw...
Mining Development Repositories to Study the Impact of Collaboration on Softw...Mining Development Repositories to Study the Impact of Collaboration on Softw...
Mining Development Repositories to Study the Impact of Collaboration on Softw...Nicolas Bettenburg
 
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source CodeUsing Fuzzy Code Search to Link Code Fragments in Discussions to Source Code
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source CodeNicolas Bettenburg
 
A Lightweight Approach to Uncover Technical Information in Unstructured Data
A Lightweight Approach to Uncover Technical Information in Unstructured DataA Lightweight Approach to Uncover Technical Information in Unstructured Data
A Lightweight Approach to Uncover Technical Information in Unstructured DataNicolas Bettenburg
 
Managing Community Contributions: Lessons Learned from a Case Study on Andro...
Managing Community Contributions:  Lessons Learned from a Case Study on Andro...Managing Community Contributions:  Lessons Learned from a Case Study on Andro...
Managing Community Contributions: Lessons Learned from a Case Study on Andro...Nicolas Bettenburg
 
Studying the impact of Social Structures on Software Quality
Studying the impact of Social Structures on Software QualityStudying the impact of Social Structures on Software Quality
Studying the impact of Social Structures on Software QualityNicolas Bettenburg
 
An Empirical Study on Inconsistent Changes to Code Clones at Release Level
An Empirical Study on Inconsistent Changes to Code Clones at Release LevelAn Empirical Study on Inconsistent Changes to Code Clones at Release Level
An Empirical Study on Inconsistent Changes to Code Clones at Release LevelNicolas Bettenburg
 
An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...
An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...
An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...Nicolas Bettenburg
 
Fuzzy Logic in Smart Homes
Fuzzy Logic in Smart HomesFuzzy Logic in Smart Homes
Fuzzy Logic in Smart HomesNicolas Bettenburg
 
Finding Paths in Large Spaces - A* and Hierarchical A*
Finding Paths in Large Spaces - A* and Hierarchical A*Finding Paths in Large Spaces - A* and Hierarchical A*
Finding Paths in Large Spaces - A* and Hierarchical A*Nicolas Bettenburg
 
Automatic Identification of Bug Introducing Changes
Automatic Identification of Bug Introducing ChangesAutomatic Identification of Bug Introducing Changes
Automatic Identification of Bug Introducing ChangesNicolas Bettenburg
 
Cloning Considered Harmful Considered Harmful
Cloning Considered Harmful Considered HarmfulCloning Considered Harmful Considered Harmful
Cloning Considered Harmful Considered HarmfulNicolas Bettenburg
 
Predictors of Customer Perceived Quality
Predictors of Customer Perceived QualityPredictors of Customer Perceived Quality
Predictors of Customer Perceived QualityNicolas Bettenburg
 
Extracting Structural Information from Bug Reports.
Extracting Structural Information from Bug Reports.Extracting Structural Information from Bug Reports.
Extracting Structural Information from Bug Reports.Nicolas Bettenburg
 
Computing Accuracy Precision And Recall
Computing Accuracy Precision And RecallComputing Accuracy Precision And Recall
Computing Accuracy Precision And RecallNicolas Bettenburg
 
Duplicate Bug Reports Considered Harmful ... Really?
Duplicate Bug Reports Considered Harmful ... Really?Duplicate Bug Reports Considered Harmful ... Really?
Duplicate Bug Reports Considered Harmful ... Really?Nicolas Bettenburg
 
The Quality of Bug Reports in Eclipse ETX'07
The Quality of Bug Reports in Eclipse ETX'07The Quality of Bug Reports in Eclipse ETX'07
The Quality of Bug Reports in Eclipse ETX'07Nicolas Bettenburg
 

Mehr von Nicolas Bettenburg (20)

10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...
10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...
10 Year Impact Award Presentation - Duplicate Bug Reports Considered Harmful ...
 
Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...
Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...
Ph.D. Dissertation - Studying the Impact of Developer Communication on the Qu...
 
Think Locally, Act Gobally - Improving Defect and Effort Prediction Models
Think Locally, Act Gobally - Improving Defect and Effort Prediction ModelsThink Locally, Act Gobally - Improving Defect and Effort Prediction Models
Think Locally, Act Gobally - Improving Defect and Effort Prediction Models
 
Mining Development Repositories to Study the Impact of Collaboration on Softw...
Mining Development Repositories to Study the Impact of Collaboration on Softw...Mining Development Repositories to Study the Impact of Collaboration on Softw...
Mining Development Repositories to Study the Impact of Collaboration on Softw...
 
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source CodeUsing Fuzzy Code Search to Link Code Fragments in Discussions to Source Code
Using Fuzzy Code Search to Link Code Fragments in Discussions to Source Code
 
A Lightweight Approach to Uncover Technical Information in Unstructured Data
A Lightweight Approach to Uncover Technical Information in Unstructured DataA Lightweight Approach to Uncover Technical Information in Unstructured Data
A Lightweight Approach to Uncover Technical Information in Unstructured Data
 
Managing Community Contributions: Lessons Learned from a Case Study on Andro...
Managing Community Contributions:  Lessons Learned from a Case Study on Andro...Managing Community Contributions:  Lessons Learned from a Case Study on Andro...
Managing Community Contributions: Lessons Learned from a Case Study on Andro...
 
Mud flash
Mud flashMud flash
Mud flash
 
Studying the impact of Social Structures on Software Quality
Studying the impact of Social Structures on Software QualityStudying the impact of Social Structures on Software Quality
Studying the impact of Social Structures on Software Quality
 
An Empirical Study on Inconsistent Changes to Code Clones at Release Level
An Empirical Study on Inconsistent Changes to Code Clones at Release LevelAn Empirical Study on Inconsistent Changes to Code Clones at Release Level
An Empirical Study on Inconsistent Changes to Code Clones at Release Level
 
An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...
An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...
An Empirical Study on the Risks of Using Off-the-Shelf Techniques for Process...
 
Fuzzy Logic in Smart Homes
Fuzzy Logic in Smart HomesFuzzy Logic in Smart Homes
Fuzzy Logic in Smart Homes
 
Finding Paths in Large Spaces - A* and Hierarchical A*
Finding Paths in Large Spaces - A* and Hierarchical A*Finding Paths in Large Spaces - A* and Hierarchical A*
Finding Paths in Large Spaces - A* and Hierarchical A*
 
Automatic Identification of Bug Introducing Changes
Automatic Identification of Bug Introducing ChangesAutomatic Identification of Bug Introducing Changes
Automatic Identification of Bug Introducing Changes
 
Cloning Considered Harmful Considered Harmful
Cloning Considered Harmful Considered HarmfulCloning Considered Harmful Considered Harmful
Cloning Considered Harmful Considered Harmful
 
Predictors of Customer Perceived Quality
Predictors of Customer Perceived QualityPredictors of Customer Perceived Quality
Predictors of Customer Perceived Quality
 
Extracting Structural Information from Bug Reports.
Extracting Structural Information from Bug Reports.Extracting Structural Information from Bug Reports.
Extracting Structural Information from Bug Reports.
 
Computing Accuracy Precision And Recall
Computing Accuracy Precision And RecallComputing Accuracy Precision And Recall
Computing Accuracy Precision And Recall
 
Duplicate Bug Reports Considered Harmful ... Really?
Duplicate Bug Reports Considered Harmful ... Really?Duplicate Bug Reports Considered Harmful ... Really?
Duplicate Bug Reports Considered Harmful ... Really?
 
The Quality of Bug Reports in Eclipse ETX'07
The Quality of Bug Reports in Eclipse ETX'07The Quality of Bug Reports in Eclipse ETX'07
The Quality of Bug Reports in Eclipse ETX'07
 

KĂŒrzlich hochgeladen

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...Nguyen Thanh Tu Collection
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 

KĂŒrzlich hochgeladen (20)

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỏ TUYỂN SINH TIáșŸNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

Approximation Algorithms

  • 1. Approximation Algorithms presented by Nicolas Bettenburg 1
  • 2. Many problems with practical signiïŹcance are NP-complete. Unlikely to ïŹnd a polynomial-time solution algorithm (nobody knows). 2
  • 3. Work around NP completeness ‱ Small Inputs: stay with exponential algorithm! ‱ Often special cases are solvable in polynomial time. ‱ Find a near-optimal solution in polynomial time that is good enough. 3
  • 4. Approximation Algorithms ‱ For a lot of practical applications near-optimal solutions are perfectly acceptable. ‱ Algorithms that return near-optimal solutions for a problem are called approximation algorithms. ‱ Want to study polynomial time approximation algorithms for NP-complete problems. 4
  • 5. What is ‘’good enough’’? For an approximation algorithm A of input of size n the cost of solution produced by A is C Approximation Ratio of A is p(n) C C∗ max , ∗ C ≀ p(n) C 5
  • 6. An approximation algorithm with ratio p(n) is called a p(n)-approximation algorithm. 6
  • 7. List of 21 Problems that are NP-complete Richard Karp, 1972 . . . ‱ CLIQUE ‱ SET PACKING ‱ VERTEX COVER ‱ SET COVERING ‱ FEEDBACK NODE SET ‱ FEEDBACK ARC SET ‱ KNAPSACK ‱ PARTITION ‱ MAX-CUT . . . 7
  • 9. Vertex Cover a subset U of all vertices V, such that every edge in E is covered. b c d a e f g Covered Edge an edge e = (vi, vj) is covered if ei or ej is chosen. 9
  • 10. Minimum Vertex Cover Problem Input: a Graph G = (V, E) Output: the smallest subset U ⊆ V such that ∀e = (vi , vj ) ∈ E, i = j vi ∈ U or vj ∈ U 10
  • 11. b c d a e f g Input: G 11
  • 12. b c d a e f g 12
  • 13. b c d a e f g 13
  • 14. b c d a e f g Output: C = {b, d, e} 14
  • 15. Greedy-Vertex-Cover(G) 1 C = {} 2 do chose v in V with max deg 3 C = C + {v} 4 remove v and every edge 5 adjacent to v 6 until all edges covered 7 return C 15
  • 16. b c d a e f g 16
  • 17. b c d a e f g 17
  • 18. b c d a e f g 3 possible choices here determines the outcome 18
  • 19. b c d a e f g 19
  • 20. b c d a e f g 20
  • 21. b c d a e f g Goodness of solution depends on the (random) choices made. 21
  • 22. Approx-Vertex-Cover(G) 1 C = {} 2 E’ = E[G] 3 while E’ != {} 4 do let (u,v) be some e in E’ 5 C = C + {u, v} 6 remove from E’ every edge 7 incident to either u or v 8 end do 9 end while 10 return C 22
  • 23. Approx-Vertex-Cover(G) 1 C = {} 2 E’ = E[G] 3 while E’ != {} 4 do let (u,v) be some e in E’ 5 C = C + {u, v} 6 remove from E’ every edge 7 incident to either u or v 8 end do 9 end while 10 return C O(|V | + |E|) 23
  • 24. b c d a e f g C = {} E = {(a-b), (b-c), (c-e), (c-d),(e-f),(e-d), (f-d), (d-g)} 24
  • 25. b c d a e f g C = {} E = {(a-b), (b-c), (c-e), (c-d),(e-f),(e-d), (f-d), (d-g)} 25
  • 26. b c d a e f g C = {b, c} E = {(e-f),(e-d), (f-d), (d-g)} 26
  • 27. b c d a e f g C = {b, c} E = {(e-f),(e-d), (f-d), (d-g)} 27
  • 28. b c d a e f g C = {b, c, e, f} E = {(d-g)} 28
  • 29. b c d a e f g C = {b, c, e, f} E = {(d-g)} 29
  • 30. b c d a e f g C = {b, c, e, f, d, g} E = {} 30
  • 31. C = {b, c, e, f, d, g} |C| = 6 = 2 · 3 ≀ 2 · |C ∗ | the algorithm found a 2-approximation. b c d a e f g 31
  • 32. Approx-Vertex-Cover(G) 1 C = {} 2 E’ = E[G] 3 while E’ != {} 4 do let (u,v) be some e in E’ 5 C = C + {u, v} 6 remove from E’ every edge 7 incident to either u or v 8 end do 9 end while 10 return C C is a vertex cover of G Proof: The algorithm loops until every edge in E’ = E[G] has been covered (removed) by some vertex in C. 32
  • 33. Approx-Vertex-Cover(G) 1 C = {} 2 E’ = E[G] 3 while E’ != {} 4 do let (u,v) be some e in E’ 5 C = C + {u, v} 6 remove from E’ every edge 7 incident to either u or v 8 end do 9 end while 10 return C C is at most 2 times C* Proof: Let A be the set of edges picked by algorithm step 4. C* must include at least one endpoint of each edge in set A. No two edges share an endpoint, since all adjacent edges are deleted after picking in line 6. Thus no two edges in A are covered by the same vertex in C*. |C ∗ | ≄ |A| 33
  • 34. Approx-Vertex-Cover(G) 1 C = {} 2 E’ = E[G] 3 while E’ != {} 4 do let (u,v) be some e in E’ 5 C = C + {u, v} 6 remove from E’ every edge 7 incident to either u or v 8 end do 9 end while 10 return C C is at most 2 times C* Proof: Each execution of line 4 picks an edge for which neither of the endpoints are in C already. |C| = 2 · |A| |C ∗ | ≄ |A| 34
  • 35. Can we do better? 35
  • 36. Maximal Matching b c d a e f g Input: a graph G=(V, E) Output: a maximal subset E’ of E, such that no two edges share a common vertex. 36
  • 37. The approximation algorithm produces a maximal matching 37
  • 38. Alternative Formulation of Vertex Cover b c d a e f g Input: a graph G=(V, E) Output: the endpoints of a maximal matching 38
  • 39. In Bipartite Graphs: Maximal Matching = Minimal Vertex Cover Stated as König’s Theorem in 1914, proven in 1916. 39
  • 40. Complete bipartite Graph with n vertices 40
  • 41. Is a tight example, has maximal matching of n. 41
  • 42. Hence |C| = 2n. So 2 is a tight bound! 42
  • 43. No better algorithm than the 2-approximation algorithm for computing the vertex cover in polynomial time is known so far. 43
  • 44. A parallel algorithm to compute the 2-approximate minimum vertex cover in O(log3|E|) with O(|V|+|E|) processors was discovered in 2006. 44
  • 46. The Set Cover Problem Input: a ïŹnite Set X Output: a family F of subsets of X, such that every element of X belongs to at least one subset in F: X = âˆȘS∈F S 46
  • 47. Set X S1 S4 S2 S6 S3 S5 Subsets S1, S2, S3, S4, S5, S6 47
  • 48. Set X S1 S4 S2 S6 S3 S5 Minimum-Size Cover: S3, S4, S5 48
  • 49. Greedy-Set-Cover(G) 1 U = X 2 C = {} 3 while U != {} do 4 select an S in F 5 that maximizes |S ∩U| 6 U = U-S 7 C = C âˆȘ{S} 8 end while 9 return C O(|X| · |F |) 49
  • 50. Greedy-Set-Cover is an (ln |X|+1)-approximation algorithm. 50
  • 51. Can we do better? 51
  • 52. Open research question 52