1 / 32

Randomized Algorithms CS648

Randomized Algorithms CS648. Lecture 10 Random Sampling part-II (To find a subset with desired property). Overview. There is a huge list (1 million) of blood donors. Unfortunately the blood group information is missing at present. We need a donor with blood group O+ . What to do ?

eman
Download Presentation

Randomized Algorithms CS648

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Randomized AlgorithmsCS648 Lecture 10 Random Sampling part-II (To find a subset with desired property)

  2. Overview • There is a huge list (1 million) of blood donors. • Unfortunately the blood group information is missing at present. • We need a donor with blood group O+. • What to do ? Solution: (Select a random subset of donors.) Repeat until we get a donor of blood group O+. { Pick phone number of a donor randomly uniformly Call him to ask his Blood group. }

  3. Random Sampling • Suppose there is a computational problem where we require to find a subset with some desired properties. • Unfortunately, computing such a set deterministically may take huge time. • Random sampling carried out suitably may produce a subset with the desired property with some probability.

  4. Randomized Algorithm for BPWM problem

  5. IntegerProduct of Matrices D A B

  6. Boolean Productof Matrices C A B

  7. Boolean Productof Matrices C A B Definition:An integer is said to be witness for a pair () if

  8. Boolean Product Witness Matrix (BPWM) Problem: Given two Boolean matrices A and B, and their Boolean product C, compute a matrix , such that: stores a witness for each () with .

  9. Motivation for BPWM

  10. All Pairs Shortest Paths (APSP) Standard Algorithms: • Floyd WarshalAlgorithm • Dijkstra’s Algorithm • BFS traversal (for unweighted graphs) RaimundSeidel: On the All-Pairs-Shortest-Path Problem in Unweighted Undirected Graphs, JCSS, 51(3): 400-403 (1995) Time complexity for APSP: O time. where is the exponent for multiplying two matrices, currently<2.317 O time in the worst case

  11. All Pairs Shortest Paths (APSP) Students having interest in algorithms are strongly advised to study this novel algorithm from Motwani-Raghwan book or the original journal version. (This is, of course, not part of the syllabus for CS648) Algorithm of RaimundSeidel: • Compute Distance Matrix in O time [Deterministic Algorithm] • Computing Shortest Path Matrix required solving BPWMproblem. • Solving BPWMproblem in Otime [Randomized algorithm]

  12. Randomized algorithm for BPWM

  13. Boolean Product Witness Matrix (BPWM) Problem: Given two Boolean matrices A and B, and their Boolean product C, compute a matrix , such that: stores a witness for each () with . Observations: • There may be many witnesses for a pair () . But our aim is to compute just one witness for each pair. • Witness for any pair () can be searched in O() time. • Verifying if is a witness for a pair () ? (these observations will be used later on. So internalize them fully now.) O() time Just check whether.

  14. Boolean Productof Matrices C A B Look carefully at the integer product matrix D. Does it have any thing to do with witnesses. =number of witnesses for () So it is worth studying for our problem D

  15. Boolean Productof Matrices D A B

  16. Boolean Productof Matrices 1 2 3 4 5 ⨯ ⨯ ⨯ ⨯ ⨯ D A B There is a way to manipulate A so that D will store a witness for all those pairs which have singleton witness. Can you guess ?

  17. Boolean Productof Matrices 1 2 3 4 5 ⨯ ⨯ ⨯ ⨯ ⨯ D A B

  18. Boolean Productof Matrices 1 2 3 4 5 ⨯ ⨯ ⨯ ⨯ ⨯ D A B • For pairs having one witness (Yellow entries), stores the witness . • For pairs having multiple witnesses (Blue entries), stores some junk value .

  19. Algorithm for Computing Singleton Witnesses Compute-Singleton-Witnesses(,) { For each  ∙;  ∙; Foreach If is a witness for ()  } Time complexity: O Note that the algorithm is a deterministic one.

  20. Algorithm Design for BPWM Subproblem: How to compute witnesses for all those pairs which have witnesses ? Solution: A randomized Monte Carlo algorithm withO time. Main Problem: How to find witnesses for all pairs ? Solution: A randomized Las Vegas algorithm with expected O time.

  21. RandomizedOAlgorithm:Finding witness for all those pairs which have witnesses

  22. Focus on a single pair (,) 1 2 3 4 … n ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ B A How to nullify the effect of witnesses ? Witnesses for (,)

  23. Focus on a single pair (,) 1 2 3 4 … n ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ B A

  24. Focus on a single pair (,) 1 2 3 4 5 … n-1 n ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ B A

  25. Focus on a single pair (,) 0 2 3 0 5 … n-1 0 ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ B A will store this witness for (,) now .

  26. Focus on a single pair (,) Question: How to select columns such that exactly one out of witnesses for (,) survives ? Answer: No efficient deterministic algorithm. Idea: (Random sampling) Question:What should be the sampling probability ? Question:What should be the sampling probability such that the expected number of surviving witnesses for (,) turn out to be 1? Answer: Try for the random sampling. No idea! Let us ask the following related but easier question.

  27. Focus on a single pair (,) Question: If each column is selected independently with , what is the probability that exactly one out of witnesses for (,) survives ? Answer: = =

  28. Randomized algorithm for Computing Witnesses for all pairs with witnesses //The pseudo code for sampling the (indices of) columns Sample(,) {  ; For each do: add to with probability ; return ; }

  29. Randomized algorithm for Computing Witnesses for all pairs with witnesses Compute-Witnesses(,,) { { Sample(,); For each if then ∙; else 0;  ∙; Foreach If is a witness for ()  } } Time complexity: O Probability of failing to find a witnessfor a single pair (): ?? How to reduce the error probability to ? Repeat the entire process times.

  30. Randomized algorithm for Computing Witnesses for all pairs with witnesses Compute-Witnesses(,,) { Repeat times { Sample(,); For each if then ∙; else 0;  ∙; Foreach If is a witness for ()  } } Time complexity: O Probability of failing to find a witnessfor a single pair (): ??

  31. Randomized algorithm for Computing Witnesses for all pairs with witnesses Compute-Witnesses(,,) { Repeat times { Sample(,); For each if then ∙; else 0;  ∙; Foreach If is a witness for ()  } } Time complexity: O Probability of failing to find a witnessfor any pair having witnesses: ?? Let there be pairs that have exactly witnesses. Apply Union theorem … <

  32. Conclusion Theorem: Given two Boolean matrices and, and integer , there is a randomized Monte Carlo algorithm to compute witnesses for all those pairs which have witnesses. • The running time is O. • The error probability is at most Questions: • How to compute witnesses for all pairs inO time. • How to convert Monte Carlo to Las Vegas ? A sketch of the solution for Question 1 was given in the class. The students are encouraged to work out the exact details. The solution will be presented in the beginning of next lecture class.

More Related