1 / 16

Las Vegas algorithm

Las Vegas algorithm. The answer obtained is always correct but sometime no answer. Modified deterministic algorithm by using randomness in the decision When dead-end restart the algo. Average running time analysis assumes some distribution of problem instances. Robinhood effect

guerram
Télécharger la présentation

Las Vegas algorithm

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. Las Vegas algorithm The answer obtained is always correct but sometime no answer. Modified deterministic algorithm by using randomness in the decision When dead-end restart the algo. Prabhas Chongstitvatana

  2. Average running time analysis assumes some distribution of problem instances. Robinhood effect LV “steal” time from the “rich” instance -- instances that were solved quickly by deterministic algo. -- to give it to the “poor” instance. Reduce the difference between good and bad instances. Prabhas Chongstitvatana

  3. Running time analysis RepeatLV each LV call success p(x); expected time t(x) before repeatLV is successful. Must consider success and failure separately Prabhas Chongstitvatana

  4. RepeatLV each LV call success p(x); expected time t(x) before repeatLV is successful. • Must consider success and failure separately • p(x) : first call LV(x) succeeds after expected time s(x) • 1-p(x) : first call LV(x) fails after expected time f(x) then restart, total expected time f(x) + t(x) Prabhas Chongstitvatana

  5. t(x) = p(x) s(x) + (1- p(x) )( f(x) + t(x) ) t(x) = s(x) + (1-p(x))/p(x) f(x) This equation guides how to “tune” various parameters. Prabhas Chongstitvatana

  6. 8-queen revisited Backtrack systematic explores k-promising vector implicit tree (search 114 of 2057 for the first soln). Use greedy LV that places queens randomly, if no soln restart Simple Prabhas Chongstitvatana

  7. p prob. of success, s number of soln explored when success, f number of soln explored when fail. Example s=9, p ~ 0.1293, f ~ 6.971. A soln is obtained more than 1 out of 8. The number of node explored by repeting until success s + (1-p)/p f ~ 55.93 compare to 114 nodes with backtrack which do systematic search. Prabhas Chongstitvatana

  8. Improve when queenLV fail restart from beginning. Use combination : some random, some backtrack. Prabhas Chongstitvatana

  9. Actual time backtrack first soln 0.45 ms 2 queens fix average time 0.14 ms 3 queens fix average time 0.21 ms all random average time 1.00 ms Why slow down of random ? The time for random number generator consume 71% . Prabhas Chongstitvatana

  10. Generalize to n-queen n = 39 nodes actual time backtrack 11,402,835,415 41 hr. queenLV 29:10 500 8.5 ms pureLV 150 ms LV gain 20 millions to 1 on the number of nodes explored and 10 millions on actual time Prabhas Chongstitvatana

  11. Probabilistic selection and sorting The problem of k-th smallest element using divide and conquer, the nearer the pivot is to the median of the element the more efficient. Prabhas Chongstitvatana

  12. Probabilistic selection and sorting The problem of k-th smallest element using divide and conquer, the nearer the pivot is to the median of the element the more efficient. Simple approach : pivot the first element linear time in average, quadratic in worst case. Prabhas Chongstitvatana

  13. SelectionLV(T[1..n],s) i = 1; j = n repeat p = T[ uniform(i.. j) ] pivotbis(T[i..j], p, k, l ) if s <= k then j = k else if s >= l then i = l else return p Expected run time is linear Prabhas Chongstitvatana

  14. Using random pivot, the execution time is independent of the instance. It is always possible that some execution will take quadratic time but the prob. will be small if n is large. Expected run time is linear on all instances with a small hidden constant. Prabhas Chongstitvatana

  15. quicksortLV(T[i..j] ) if j-i is sufficiently small then insertsort(T[i..j] ) else p = T[ uniform(i..j) ] pivotbis( T[i..j], p, k, l ) quicksortLV(T[i..k] ) quicksortLV(T[l..j] ) Worst-case expected time O(n log n) Prabhas Chongstitvatana

  16. LV running time is independent of specific instances. Probabilistic approach Deterministic algo. that has excellent average execution time on all instances of some particular size except certain instances. Turn that into LV that is efficient with high probability whatever the instance considered. Prabhas Chongstitvatana

More Related