Docsity

Advanced Algorithms - Lecture Notes | CS 501, Study notes of Algorithms and Programming

Toggle sidebar
bg1
CS 501: Advanced Algorithms Fall 2008
Lecture 1 — August 28
Lecturer: Tanya Berger-Wolf Scribe: David Smits
1.1 Overview
This is the first lecture. We will review N P -completeness1 2 and decision problems.
1.2 NP -completeness
1.2.1 Decison Problems
Definition 1. adecision problem is characterized by:
•a set of input instances Dand a parameter k
•a set of feasible solutions S(I)for input I∈D
•a yes or no question: exists a feasible solution s∈S(I)of value bounded by k?
Example: MST - Minimum Spanning Tree
•Input: G= (V, E ), w :E→ <+, k ∈ <+
•Solution: All spanning trees Tin G
•Question: Does there exist Twith weight ≤k?
Example: SAT - Maximum Satisfiability
•Input: A boolean function (φ-boolean CNF) with nvars and mclauses and k∈N
•Solution: Assignment of values to variables A
•Question: Does there exist an assignment Asuch that at least kclauses are satisfied?
1http://www.claymath.org/millennium/P vs NP/Official Problem Description.pdf
2http://www.cs.berkeley.edu/ luca/cs172/karp.pdf
1-1
pf3
pf4

Partial preview of the text

Download Advanced Algorithms - Lecture Notes | CS 501 and more Study notes Algorithms and Programming in PDF only on Docsity!

CS 501: Advanced Algorithms Fall 2008

Lecture 1 — August 28

Lecturer: Tanya Berger-Wolf Scribe: David Smits

1.1 Overview

This is the first lecture. We will review NP -completeness1 2^ and decision problems.

1.2 NP -completeness

1.2.1 Decison Problems

Definition 1. a decision problem is characterized by:

  • a set of input instances D and a parameter k
  • a set of feasible solutions S(I) for input I ∈ D
  • a yes or no question: exists a feasible solution s ∈ S(I) of value bounded by k?

Example: MST - Minimum Spanning Tree

  • Input: G = (V, E), w : E → <+, k ∈ <+
  • Solution: All spanning trees T in G
  • Question: Does there exist T with weight ≤ k?

Example: SAT - Maximum Satisfiability

  • Input: A boolean function (φ-boolean CNF) with n vars and m clauses and k ∈ N
  • Solution: Assignment of values to variables A
  • Question: Does there exist an assignment A such that at least k clauses are satisfied? (^1) http://www.claymath.org/millennium/P vs NP/Official Problem Description.pdf (^2) http://www.cs.berkeley.edu/ luca/cs172/karp.pdf

Example VC - Minimum Vertex Cover

  • Input: G = (V, E) and k ∈ N
  • Solution: Subset of vertices S ⊆ V , ∀(u, v ) ∈ E either u ∈ S or v ∈ S
  • Question: Does there exist such S with at most k vertices?

1.2.2 P and NP

Definition 2. a ”yes” certificate for an input instance I ∈ D of a decision problem is a feasible solution s ∈ S(I) that satisfies the parameter in the question

Definition 3. P and NP

  • a decision problem is polynomial time solveable (P ) if in time polynomial in the size of the input I we can find and verify a ”yes” certificate
  • a decison problem is nondeterminsitic polynomial time solvable (NP ) if in time poly- nomial in the size of the input I we can verify a ”yes” certificate

Note: P ⊆ NP

Example of a problem in P - MST

  • Certificate: A tree with weights that sum to less than or equal to k
  • To Find: Finding a minimum spanning tree - polynomial time ( using Prim’s or Kruskal’s algorithm )
  • To Verify: Check the weight vs. k

Example of a problem in NP - SAT

  • Certificate: An assignment A of variables that satisfies at least k clauses
  • To Verify: Verifying that A satisfies at least k clauses, substitue values in A and test each clause, counting how many are satisfied and compare to k - polynomial ( linear )

Example of a problem in NP - Vertex Cover

  • Certificate: A subset S of vertices of size at most k that covers all edges in the graph
  • To Verify: To verify, iterate through each edge (u, v ) ∈ G and check either u ∈ S or v ∈ S, size of the subset is at most k, linear time
  • examples: smoothed complexity analysis^5
  • Pros: Good on average and for must inputs
  • Cons: Gets stuck on some (possibly important) inputs. Input distribution is un- known
  • Not Exact: Approximation Algorithms
  • Pros: Typically good enough in practice, difference between good and perfect is minimal
  • Cons: The difference is expensive to achieve

(^5) Smoothed Complexity Analysis: http://www.cs.yale.edu/homes/spielman/SmoothedAnalysis/