Todays Topics Computer Science Program Execution Time Intractable

Today’s Topics Computer Science Program Execution Time: Intractable Algorithms Upcoming Parallel Computing Great Ideas, Chapter 14 Reading Great Ideas, Chapter 13 Comp. Sci 001 37. 1

On the Limits of Computing v Intractable Algorithms q q q v Computer "crawls" or seems to come to halt for large N Large problems essentially unsolved May never be able to compute answer for some obvious questions Chess q q Note: here N is number of moves looking ahead We have an Algorithm! o Layers of look-ahead: If I do this, then he does this, . . o Problem Solved (? !) q q q v Can Represent Possibilities by Tree Assume 10 Possibilities Each Move t = A * 10 N Exponential ! ! ! Comp. Sci 001 37. 2

Exponential Algorithms v Recognizing Exponential Growth q q q v v Exponential = Intractable Traveling Salesperson Example q q v v Visit N Cities in Optimal Order Optimize for minimum: o Time o Distance o Cost N factorial (N!) Possibilities N! is (very) roughly N N q v Things get BIG very rapidly Numbers seem to EXPLODE KEY: at each added step, work multiplies rather than adds Sterling’s approximation: N! = sqrt(2*Pi*N)*(N/e)N Typical of some very practical problems Comp. Sci 001 37. 3

Traveling Salesperson Examples v 3 cities 2! = 2 possible routes (1 of interest) q q v 4 cities 3! = 6 possible routes (3 of interest) q q q v abc acb abcd abdc acbd acdb adbc adcb (Only half usually of interest because just reverse of another path) Comp. Sci 001 37. 4

Traveling Salesperson Examples 5 cities 4! = 24 possible routes q q q abcde abced abdce abdec abecd abedc (12 of interest) q q q q acbde acbed acdbe acdeb acebd acedb Comp. Sci 001 q q q adbce adbec adcbe adceb adebc adecb aebcd aebdc aecbd aecdb aedbc aedcb 37. 5

Towers of Hanoi N 5 10 15 20 25 30 35 t = 0. 00549 * 2 N t PC) . 17 sec 5. 62 sec 3. 00 min 1. 6 hour 2. 13 day 68. 23 day 5. 98 year computer 40 191. 3 year 45 6120 year 50 196 K year 55 6. 27 M year 60 201 M year 65 Comp. Sci 001 6. 42 G year 70 205 G year (for a very old What would a faster do for these numbers? 37. 6

Intractable Algorithms v Other Games v More hardware not the answer! v Predicting Yesterday's Weather v Actual Examples for Time Complexity Comp. Sci 001 37. 7
- Slides: 7