Sep 12, 2013 Lirong Xia Introduction to computation.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

Sep 16, 2013 Lirong Xia Computational social choice The easy-to-compute axiom.
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Sep 15, 2014 Lirong Xia Computational social choice The easy-to-compute axiom.
Linear Programming (LP) (Chap.29)
What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Computational problems, algorithms, runtime, hardness
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
1 Optimization problems such as MAXSAT, MIN NODE COVER, MAX INDEPENDENT SET, MAX CLIQUE, MIN SET COVER, TSP, KNAPSACK, BINPACKING do not have a polynomial.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
NP-complete and NP-hard problems
Analysis of Algorithms CS 477/677
Computational Complexity, Physical Mapping III + Perl CIS 667 March 4, 2004.
NP-complete examples CSC3130 Tutorial 11 Xiao Linfu Department of Computer Science & Engineering Fall 2009.
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
NP-complete and NP-hard problems. Decision problems vs. optimization problems The problems we are trying to solve are basically of two kinds. In decision.
Hardness Results for Problems
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Approximating Minimum Bounded Degree Spanning Tree (MBDST) Mohit Singh and Lap Chi Lau “Approximating Minimum Bounded DegreeApproximating Minimum Bounded.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Linear Programming Data Structures and Algorithms A.G. Malamos References: Algorithms, 2006, S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani Introduction.
CSC 413/513: Intro to Algorithms NP Completeness.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
Approximation Algorithms Department of Mathematics and Computer Science Drexel University.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Great Theoretical Ideas in Computer Science.
0 Fall, 2016 Lirong Xia Computational social choice The easy-to-compute axiom.
Introduction to computation
The NP class. NP-completeness
Computational problems, algorithms, runtime, hardness
Linear Programming Duality, Reductions, and Bipartite Matching
1. for (i=0; i < n; i+=2) if (A[i] > A[i+1]) swap(A[i], A[i+1])
Chapter 11 Limitations of Algorithm Power
CPS 173 Computational problems, algorithms, runtime, hardness
Computational social choice
Presentation transcript:

Sep 12, 2013 Lirong Xia Introduction to computation

Agents (players): N ={ 1,…,n } Outcomes: O Preferences (private): total preorders over O Message space (c.f. strategy space): S j for agent j Mechanism: f : Π j S j → O 1 Last class: mechanism design R1*R1* R1R1 Outcome R2*R2* R2R2 Rn*Rn* RnRn Mechanism f … … Strategy Profile D True Profile D * f *

Computation (completely different from previous classes)! Linear programming: a useful and generic technic to solve optimization problems Basic computational complexity theorem –how can we formally measure computational efficiency? –how can we say a problem is harder than another? HW2 out later today Remember you will be need to answer the “why what how” question 2 Today’s schedule

strength minerals gas supply Zealot Stalker Archon Available resource: How to maximize the total strength of your troop? 3 The last battle mineral gas supply

Variables – x Z : number of Zealots – x S : number of Stalkers – x A : number of Archons Objective: maximize total strength max 1 x Z + 2 x S + 10 x A Constraints – mineral: 100 x Z x S x A ≤ 2000 – gas: 0 x Z + 50 x S x A ≤ 1500 – supply: 2 x Z + 2 x S + 4 x A ≤ 30 – x Z, x S, x A ≥ 0, integers 4 Computing the optimal solution str m g s Z S A Resource

Given –Variables x: a row vector of m positive real numbers –Parameters (fixed) c: a row vector of m real numbers b: a column vector of n real numbers A: an n×m real matrix Solvemax cx T s.t. Ax T ≤ b, x ≥ 0 Solutions –x is a feasible solution, if it satisfies all constraints –x is an optimal solution, if it maximizes the objective function among all feasible solutions 5 Linear programming (LP)

Possibly negative variable x – x = y – y ’ Minimizing cx T –max -cx T Greater equals to ax T ≥ b –- ax T ≤ - b Equation ax T = b –ax T ≥ b and - ax T ≤ - b Strict inequality ax T < b –no “theoretically perfect” solution –ax T ≤ b - ε 6 General tricks

Integer programming (IP): all variables are integers Mixed integer programming (MIP): some variables are integers 7 Integrality constraints

LP: can be solved efficiently –if there are not too many variables and constraints IP/MIP: some instances might be hard to solve –practical solver: CPLEX free for academic use! 8 Efficient solvers

n professors N = { 1, 2,…, n }, each has one course to teach m time slots S –slot i has capacity c i –e.g. M&Th 12-2 pm is one slot –course takes one slot Degree of satisfaction (additive) for professor j – S j 1, S j 2, …, S j k are subsets of S. s j 1, …, s j k are real numbers if j is assigned to a slot in S j l, then her satisfaction is s j l E.g. S j 1 is the set of all afternoon classes – N j is a subset of N For each time confliction (allocated to the same slot) of j with a professor in N j, her satisfaction is decreased by 1 Objective: find an allocation –utilitarian: maximize total satisfaction –egalitarian: maximize minimum satisfaction 9 My mini “course project”

How to model an allocation as values of variables? –for each prof. j, each slot i, a binary (0-1) variable x ij –each prof. j is assigned to exactly one course for every j, Σ i x ij = 1 –each slot i is assigned to no more than c i profs. for every i, Σ j x ij ≤ c i How to model the satisfaction of prof. j ? –allocated to S j l if and only if Σ i ∈ S j l x ij = 1 –confliction with j* ∈ S j : x ij + x ij* =2 for some i for each pair of profs. ( j, j * ), a variable s.t. for every i, y jj* ≥ x ij + x ij* - 1 How to model the objective? –utilitarian: max Σ j [ Σ l ( s j l Σ i ∈ S j l x ij ) - Σ j* ∈ N j y jj* ] –egalitarian: max min j [ Σ l ( s j l Σ i ∈ S j l x ij ) - Σ j* ∈ N j y jj* ] 10 Modeling the problem linearly

variables – x ij for each i, j –integers: y jj* for each j, j* max Σ j [ Σ l ( s j l Σ i ∈ S j l x ij )- Σ j* ∈ N j y jj* ] s.t.for every j : Σ i x ij = 1 for every i : Σ j x ij ≤ c i for every i, j, j*: y jj* ≥ x ij + x ij* Full MIP (utilitarian) Prof. j ’s course is assigned to slot i j and j* have confliction j gets exactly one slot slot capacity j and j* are both assigned to i

variables – x ij for each i, j –integers: y jj* for each j, j* max x s.t.for every j : Σ i x ij = 1 for every i : Σ j x ij ≤ c i for every i, j, j*: y jj* ≥ x ij + x ij* - 1 for every j : x ≤ Σ l ( s j l Σ i ∈ S j l x ij )- Σ j* ∈ N j y jj* 12 Full MIP (egalitarian) Prof. j ’s course is assigned to slot i j and j* have confliction j gets exactly one slot slot capacity j and j* are both assigned to i

13 Why this solves the problem? Any optimal solution to the allocation problem Any optimal solution to the MIP

You can prioritize professors (courses) add weights –e.g. a big undergrad course may have heavier weight You can add hard constraints too –e.g. CS 1 must be assigned to W afternoon Side comment: you can use other mechanisms e.g. sequential allocation 14 Variants

Given m, and m positional scoring rules, does there exist a profile such that these rules output different winners? Objective: output such a profile with fewest number of votes 15 Your homework

16 Theory of computation History Running time of algorithms –polynomial-time algorithms Easy and hard problems –P vs. NP –reduction

“Given a Diophantine equation with any number of unknown quantities and with rational integral numerical coefficients: To devise a process according to which it can be determined in a finite number of operations whether the equation is solvable in rational integers.” Diophantine equation: p ( x 1,…, x m ) = 0 – p is a polynomial with integer coefficients Does there exist an algorithm that determines where the equation has a solution? Answer: No! 17 Hilbert’s tenth problem

18 What is computation? Input Output Computation Binary (yes-no): decision problem Values: optimization problem

Dominating set (DS): –Given a undirected graph and a natural number k. –Does there exists a set S of no more than k vertices so that every vertex is either in S, or connected to at least one vertex in S Example: Does there exists a dominating set of 2 vertices? 19 A decision problem

20 How to formalize computation? Input Output Turing machine Church-Turing conjecture Alonzo Church 1903–1995 Alan Turing 1912–1954 Drama on campus! Turing’s most cited work “The chemical basis of morphogenesis”

Number of “basic” steps –basic arithmetic operations, basic read/write, etc –depends on the input size f ( x ): number of “basic” steps when the input size is x –computer scientists care about running time of “large” problems 21 Running time of an algorithm

Given two real-valued functions f ( x ), g ( x ) f is O ( g ) if there exists a constant c and x 0 such that –for all x > x 0, | f ( x )| ≤ cg ( x ) – f is O ( 2x ) ⇔ f is O ( x ) ⇒ f is O ( x 2 ) g is an asymptotic upper bound of f –up to a constant multiplicative factor Can we say an O ( x 2 ) algorithm always runs faster than an O ( x ) algorithm? –No Can we say an O ( x ) algorithm runs faster than an O ( x 2 ) algorithm? –No 22 The big O notation

23. x f(x)f(x) * * * * * * * * * * O(x)O(x) O(x2)O(x2) O(2x)O(2x) Example

An algorithm is a polynomial-time algorithm if –there exists g ( x ) = a polynomial of x e.g. g ( x ) = x x 7 +3 –such that f is O ( g ) Running time is asymptotically bounded above by a polynomial function Considered “fast” in most part of the computational complexity theory 24 Polynomial-time algorithms

P (polynomial time): all decision problems that can be solved by deterministic polynomial-time algorithms –“easy” problems –Linear programming NP (nondeterministic polynomial time, not “Not P”): all decision problems that can be solved by nondeterministic Turing machines in polynomial-time –“believed-to-be-hard” problems Open question: is it true that P = NP? –widely believed that P ≠ NP –$1,000,000 Clay Mathematics Institute Prize If P = NP, –current cryptographic techniques can be broken in polynomial time –many hard problems can be solved efficiently 25 P vs. NP

P: design a polynomial-time deterministic algorithm to give a correct answer NP: for every output, design a polynomial-time deterministic algorithm to verify the correctness of the answer –why this seems harder than P? –Working on Problem 5’ vs reading the solution 26 To show a problem is in:

Of course you can define it by –the fastest algorithm for A is faster than the fastest algorithm for B –What is the fastest algorithm? A mathematician and an engineer are on desert island. They find two palm trees with one coconut each. The engineer climbs up one tree, gets the coconut, eats. The mathematician climbs up the other tree, gets the coconut, climbs the other tree and puts it there. "Now we've reduced it to a problem we know how to solve." 27 How to prove a problem is easier than another?

Provides a formal, mathematical way to say “problem A is easier than B” Easier in the sense that A can be reduced to B efficiently –how efficiently? It depends on the context 28 Complexity theory

Polynomial-time reduction: convert an instance of A to an instance of another decision problem B in polynomial-time –so that answer to A is “yes” if and only if the answer to B is “yes” If you can do this for all instances of A, then it proves that B is HARDER than A w.r.t. polynomial-time reduction But it does not mean that B is always harder than A 29 How a reduction works? Instance of A Instance of B Yes No Yes No P-time

“Harder” than any NP problems w.r.t. polynomial-time reduction –suppose B is NP-hard NP-hard problems –Dominating set –Mixed integer programming 30 NP-hard problems Instance of any NP problem A Instance of B Yes No Yes No P-time

exity_Zoo 31 Any more complexity classes?

Linear programming Basic computational complexity –big O notation –polynomial-time algorithms –P vs. NP –reduction –NP-hard problems 32 Wrap up

More on computational complexity –more examples of NP-hardness proofs Computational social choice: the easy-to- compute axiom –winner determination for some voting rules can be NP-hard! –solve them using MIP in practice 33 Next class