ADVANCED ALGORITHMS Lecture 26: Intractability, review � 1
ANNOUNCEMENTS ➤ HW 6 is due this Friday zip file on Canvas f ➤ Project final deadline: Tomorrow! one submission per group ➤ Final exam — see practice finals and finals of 2016-17 OR printed allowed everything offline tuesday in this classroom � 2
COMPLEXITY CLASSES, P, NP ➤ Decision problems — classes P and NP ➤ NP — non-deterministic polynomial time � 3
CLASS NP Decision problem. does the given graph have an independent set of size k? Sudoku witness w Verifier (polynomial time) Verifier accepts witness iff G is a YES instance � 4
REDUCTIONS — LAST CLASS N p Q Two decision problems, Q and Q’ fl I YES 1. Mapping poly time IT YES 2. Yes instances get mapping “f” mapped to Yes 3. No instances get mapped to No NO NO instances of Q of size N instances of Q’ of size poly(N) � 5
REDUCTIONS — WHY? Q Epa ➤ If problem Q’ can be solved in polynomial time, so can problem Q ➤ If problem Q cannot be solved in polynomial time, neither can Q’ reducing a Ebbinghaus e.g ➤ Proving “easyness”: reduce given problem to a known easy problem ➤ Proving “hardness”: reduce a “hard” problem to given problem! example hard problem? � 6
SATISFIABILITY (SAT) a y Do there exist boolean variables x such that y is true? 1. Believe there is NO polynomial time algorithm 2. Can’t do better than exhaustive search or 3. Don’t know how to prove this! 4. (Cook-Levin): any problem in NP reduces to SAT in � 7
REDUCTIONS FROM SAT “SAT reduces to my problem” � 8
OTHER COMMENTS is NP hard if Q SAT 1pA ➤ Complexity “classes” P , NP; notions of NP-hard, NP-complete f Q is NP complete ➤ Why is it useful to know a problem is NP-hard? can't hope to solve in general hiafqq.sa say Epa 9ei I I Emi.ES m i ➤ Di ffi culty of proving P != NP run best known 2 ForSA Ion known lower bounds � 9
3-SAT ➤ 3-SAT is a basic NP-complete problem — starting point for many 7 reductions ➤ 2-SAT is easy ➤ 4-SAT, 5-SAT, etc. are only harder — can you see why? 3 SAT SAT Ep 3 SAT Ep Q � 11
REDUCTIONS — EXAMPLE 3 SAT SAT Ep ➤ Last class — outline of SAT —> 3-SAT l I l It t SAT reduces to 3-SAT, thus 3-SAT is NP-hard � 10
3-SAT < P INDEPENDENT SET NO Xn X i XgXy Xl n T F F 8 T polyk size C VI VX X C g I cx.IT i s i i cm O � 12
I I o avg n and m Guha 3m ventices across clause edges II Edgesi Xi between Xi in clause edges an IS of size E Does there exist Goat we start with a YES instance if Can be shown can find such an I S of 3 SAT we we start NO if r ounce of I S get a
INDEPENDENT SET is also NP hard IS Cousy SAT Ep 3 SAT Ep IS t t how earlier � 13
APPROXIMATION ➤ Fundamental question: do NP-complete problems have good approximation algorithms? (saw many examples) 2 ➤ Are there limits to approximation? hiring problem O 63 factor approx � 14
there are problems for which even PCP THEOREM is NP hard approximating ➤ “Gap inducing reductions” i with ➤ SAT —> GAP-3-SAT graphs ind set g I X i t Ind set pdg.cm � 15
n n
REVIEW � 16
THOUGHTS ON COURSE ➤ Most variance in background I’ve seen a ➤ Focus on the high level, but know that details can be hard (HWs, project) b ➤ “ Algorithmic thinking” — not just a few “basic algorithms” that apply everywhere ➤ Notions of e ffi ciency, complexity are everywhere; space, time, approximation, … randomness Importanceof reasoning � 17
TOPICS FOR THE INTERESTED most textbooks ➤ Details of basic graph algorithms ➤ Distributed algorithms ➤ “Online” and other models ➤ Noise tolerant computation ➤ Quantum algorithms factor efficiently number n digit qubits j Dt in 01ns A 2 G l O I r � 18
EXAM ➤ More of sanity check ➤ Much easier than HW — think simple ➤ Identify key “ideas” covered and understand to reasonable detail � 19
Recommend
More recommend