Presentation is loading. Please wait.

Presentation is loading. Please wait.

 Analysis Wrap-up. What is analysis?  Look at an algorithm and determine:  How much time it takes  How much space it takes  How much programming.

Similar presentations


Presentation on theme: " Analysis Wrap-up. What is analysis?  Look at an algorithm and determine:  How much time it takes  How much space it takes  How much programming."— Presentation transcript:

1  Analysis Wrap-up

2 What is analysis?  Look at an algorithm and determine:  How much time it takes  How much space it takes  How much programming manpower it takes  Choose wisely between multiple correct solutions

3 Problem-Solving  Brute Force  Iterate  Divide-and-Conquer  Greedy  Dynamic Programming

4 Model the world  Arrays & Linked Lists  Stacks & Queues  Priority Queues & Heaps  Graphs & Trees  Binary Search Trees  Hash tables

5 Famous (Efficient) Algorithms  Binary Search  Find the median  Sort  Graph Search  Topological Sort  Shortest Path  Minimum Spanning Trees  Knapsack Problem  Huffman’s Encoding

6 The Point  Know your problem-solving tools  Be able to choose the right tool for the job  Know the limits of your tools…

7 Back to Theory  Sets: NP, P, NP-Complete  Prove NP-Complete through reduction proofs.  But: some things are uncomputable, and this is different from NP-Complete.

8 What Next?  What do you do when you need to solve an NP-Complete problem?  Redefine the problem  Approximate a solution  Use AI techniques!

9 Intelligent Search  If I have to use brute force, I want to do it smartly.  Heuristics!  Add a “good enough” threshold so you can stop searching when you find an approximate solution.  One such technique is Genetic Algorithms…

10 Genetic Algorithms  Inspired by biology/evolution  Start with a random sample of possible solutions  Fitness Function: test how good each solution is  Make new solutions:  Make a small mutation to an existing solution  Cross-breed 2 existing solutions  Keep best solutions and discard the rest.  Iterate until you run out of time

11 Example: TSP  Trying to visit 5 cities: A, B, C, D, E  Randomly make some possible paths: BDECA, ABCED, …  Try them. Fitness Function?  Mutate: BD ECA -> DB ECA  Crossover: BD ECA + A B CE D = BDACE (First 2 of the first parent and rest of ordering from 2 nd parent.)

12 TSP Example: 30 Cities

13 Solution i (Distance = 941)

14 Solution j (Distance = 800)

15 Solution k (Distance = 652)

16 Best Solution (Distance = 420)

17 Overview of Performance


Download ppt " Analysis Wrap-up. What is analysis?  Look at an algorithm and determine:  How much time it takes  How much space it takes  How much programming."

Similar presentations


Ads by Google