200 likes | 345 Views
An overview of lecture 8. When is a problem parallelizable? The complexity classes P and NC and the notion of P-completeness. The Circuit Value Problem is P-complete. When is a problem parallelizable?.
E N D
An overview of lecture 8 • When is a problem parallelizable? • The complexity classes P and NC and the notion of P-completeness. • The Circuit Value Problem is P-complete. Advanced Topics in Algorithms and Data Structures
When is a problem parallelizable? • A problem is parallelizable if it can be solved very fast with a reasonable number of processors. • By very fast, we mean polylogarithmic time, i.e., O(logk n) time for some fixed constant k and input size n. • Another requirement is that the number of processors used should be a polynomial in the input size, i.e., O(nc) for a fixed constant c. Advanced Topics in Algorithms and Data Structures
The class NC • We now discuss the complexity class NC. This is Nick’s class in honour of Nick Pippenger. • The class NC consists of all the problems that can be solved by polylogarithmic-time algorithms on a PRAM, using a polynomial number of processors. Advanced Topics in Algorithms and Data Structures
The class NC • The class NC is defined to be the set of all language L such that: • on all inputs of length n, • L can be recognized by a PRAM algorithm running in O(logk n)time. Advanced Topics in Algorithms and Data Structures
P and NC • Let P be the class of all languages that can be recognized by a deterministic Turing machine within a polynomial number of steps. • P can be defined as the class of all problems that can be solved on a RAM in polynomial time. Advanced Topics in Algorithms and Data Structures
P and NC • Obviously, NCP since we can take any NC algorithm and convert it into a polynomial time sequential algorithm. • However, it is not known whether PNC. • Most people believe that PNC. Advanced Topics in Algorithms and Data Structures
P and NC • If PNC, then there must be problems in P that cannot be solved efficiently in parallel. • The class of P-complete problems are most likely candidates of problems that are not in NC. Advanced Topics in Algorithms and Data Structures
P and NC • The situation is similar to the relationship between the class NP and P. • If someone can prove that there is a polynomial-time algorithm for at least one NP-complete problem, then there are polynomial time algorithms for all NP-complete problems. Advanced Topics in Algorithms and Data Structures
Reducibility • Similarly, if there is a polylogarithmic-time algorithm for at least one P-complete problem, then there are polylogarithmic-time algorithms for all P-complete problems. • How do we prove a problem to be P-complete? Advanced Topics in Algorithms and Data Structures
Reducibility • Let L1 and L2 be two languages. The language L1 is NC-reducible to the language L2 if: • there exists an NC-algorithm that transforms an arbitrary input u1 for L1 into an input u2 for L2 such that: u1L1 if and only if u2L2. Advanced Topics in Algorithms and Data Structures
The notion of P-completeness • A language L is P-complete if: • LP, and • every language in P is NC-reducible to P. • The next question is: Is there a P-complete problem? Advanced Topics in Algorithms and Data Structures
The Circuit Value Problem (CVP) • We are given a Boolean circuit consisting of NOT gates and two-valued AND and OR gates. • The problem is to determine the output of the Boolean circuit for a given set of inputs. • More precisely, our Boolean circuit C is specified by a sequence of gates C = < g1, g2, …, gn >. Advanced Topics in Algorithms and Data Structures
The Circuit Value Problem (CVP) • Each gi is: • either an input, or • gi = gj gk, or gi = gj gk , or gi = gj for j, k < i. Advanced Topics in Algorithms and Data Structures
CVP is P-complete • We need to prove that: • CVP is in P, and • An arbitrary language LP is NC-reducible to CVP. • CVP is clearly in P. • Given an n-gate CVP, we can • evaluate the gates sequentially in O(n) time by evaluating g1, g2, …, gn. Advanced Topics in Algorithms and Data Structures
CVP is P-complete • We next show that an arbitrary language LP is NC-reducible to CVP. • We provide an NC algorithm that takes an arbitrary instance IL of L, and • maps IL into an instance ICVP of CVP such that, • IL has a yes answer if and only if ICVP has a value 1. Advanced Topics in Algorithms and Data Structures
Turing machine Advanced Topics in Algorithms and Data Structures
Turing machine • Since LP , there exists a one-tape deterministic Turing machine M that accepts L in polynomial time T(n), for an input size n. • We can assume that the input bits appear in n consecutive tape cells numbered 1 to n and all other cells are initially blank. • The tape head is initially scanning cell 1 and after T(n) steps, the output is written into cell 1. Advanced Topics in Algorithms and Data Structures
Turing machine • Let Q = { q1,…, qs } be the set of states of M and q1 is the initial state. • Let = { a1,…, am } be the tape alphabet. • The state transition function is given by: : Q Q {L , R } Advanced Topics in Algorithms and Data Structures
Turing machine • We will show how to construct a Boolean circuit C such that the value of C is 1 if and only if M accepts L, i.e., cell 1 contains 1 at time T(n). • Note that, M can only access T(n) cells in T(n) time. Hence, all cell indices i will be in the range 1iT(n). • All time steps are within the range 0tT(n). • There are only s states in M hence, all states qj are within the range 1js. Advanced Topics in Algorithms and Data Structures
Some tools • The circuit C will be defined by the following Boolean functions: • H(i , t), such that H(i , t) = 1 if and only if the head scans cell i at time t. • C(i , j, t), such that C(i , j, t) = 1 if and only if cell i contains character aj at time t. • S(k , t), such that S(k , t) = 1 if and only if the state of M is qk at time t. Advanced Topics in Algorithms and Data Structures