NPC part 2
Objectives
Notes
- Input/Solutions and representation
- In the end everything we are interested in can be represented in binary.
- So is there anything in the set NPC?
- Remember, everything in NP must map the problem in polynomial time.
- This seems an impossible task since we don't even know if there is one problem in the set!
- Circuit Satifiability (CIRCUIT-SAT)
- Given a circuit, can you find a set of inputs that makes the circuit true?
- There will be a set of n inputs
- And one way to solve this is try all 2n combinations.
- We don't know any really good way to do this otherwise.
- But if we have a circuit and a set of input, we can fairly easily see that evaluating that circuit for a given set of input can be done in polynomial time.
- Therefore CIRCUIT-SAT ∈ NP
- Can we show it is in NPC?
- Remember, this is an overview.
- But for every problem in NPC, there is a algorithm A that can check the certificate C for correctness in Polynomial time.
- A computation consists of
- A set of hardware, that executes in polynomial time
- A state or set of memory.
- This includes input
- variables
- To perform a computation, we need to execute machine
- on state 0 to produce state 1
- and on state 1 to produce state 2
- and so on.
- In particular we want to execute A with C as the input.
- This will have a polynomial number of states (Since the problem we are testing in in NP)
- And in the end, there will be an answer in the final state if the solution is correct or not.
- This can all be done in polynomial time.
- We have constructed a (big) circuit in polynomial time that
- Given an algorithm we know must exist
- Will answer yes or know if a solution is correct
- So if we can find an input (in polynomial time) that produces the answer "yes" in this circuit, we have an answer (in polynomial time) to any problem in the set NPC!
- Thus every problem in NPC has been reduced in polynomial time to CIRCUIT-SAT
- Thus CIRCUIT-SAT ∈ NPC
- After this, a large number of problems have been shown to be NP-Complete.
- This is usually done by a reduction proof.
- For example, SAT
- Given a boolean expression consisting of and, or and not, can you find a input that results in a true?
- Showing this is in NP is easy, again just checking the value of an equation.
- You can show that CIRCUIT-SAT ≤PSAT
- Given an circuit, construct the equation from that circuit
- If the equation is satifiable, the circuit is then satisifable from the same input.
- And Finding the input for the equation provides the answer tot he input for the circuit
- Some care needs to be used to make sure this is a polynomial construction
- But it is doable.
- This SAT ∈ NPC
- There is a fairly good modern overview of this problem here.
- While he doesn't dismiss this problem.
- He points out how we are working around the problem.
- In some way, P=NP is perhaps a temporary detour.
- This is worth a read/watch.
- Why is this true?
- Heuristics, restrictions, ...
- The traveling salesperson problem (TSP)
- Given a complete weighted graph
- What is the least cost path to visit each city exactly once and return to the starting city?
- TSP ∈ NPC
- But
- If we can restrict it so that the triangle inequality holds
- Given u,v,w ∈ G.V, w(u,v) ≤ w(u,v) + w(v,w)
- This is true for distances (that don't involve mountains)
- But not necessarily true for air fair.
- If this is true, we can solve the TSP problem by creating a MST
- Thus TSP become O(V+E)
- By just selecting the lowest cost unvisited vertex, an algorithm can be derived that produces a solution that is no more than 25% more expensive than the optimal for most cases.
- However some cases exist where it will produce the worst path.
- Think Quicksort
- Christofides and Serdyukov have produced an algorithm that will guarantee 1.5 times optimal.
- And the list of improvements grows.