using python to solve
play

Using Python to Solve Computationally Hard Problems Using Python to - PowerPoint PPT Presentation

Using Python to Solve Computationally Hard Problems Using Python to Solve Computationally Hard Problems Rachael Madsen Optimal Design Software LLC BS in Mathematics Software Engineer & Architect Python programmer


  1. Using Python to Solve Computationally Hard Problems

  2. Using Python to Solve Computationally Hard Problems Rachael Madsen Optimal Design Software LLC – BS in Mathematics – Software Engineer & Architect – Python programmer rachael@optimaldesignsoftware.com

  3. NP-Complete Problems

  4. NP-Complete Problems An individual solution can be checked for correctness in polynomial time, but.. A solution cannot be derived in polynomial time

  5. NP-Complete Problems Nodes 1 5 10 64 Polynomial ( 𝒐 𝟑 ) 1 25 100 4096 Exponential ( 𝟑 𝒐 ) 1.8 x 10 19 2 32 1024 120 3.6 x 10 6 1.3 x 10 89 Factorial (n!) 1

  6. NP-Complete Problems • Sequencing tasks or objects for any optimization • Database design & normalization • Games

  7. The Traveling Salesman Problem

  8. Traveling Salesman Problem Given a list of cities and their pairwise distances, find the shortest possible route that visits each city exactly once and returns to the origin city.

  9. Algorithms

  10. Algorithms Changing data may change which algorithm is best

  11. Algorithms Searching available software implementations may yield the best results

  12. Algorithms Considerations

  13. Algorithms > Considerations Ease of Implementation

  14. Algorithms > Considerations Quality of Solution

  15. Algorithms > Considerations > Quality of Solution You are looking for a solution, not the solution

  16. Algorithms > Considerations > Quality of Solution ∞ 𝜌 = 1 4 2 1 1 16 𝑙 8𝑙 + 1 − 8𝑙 + 4 − 8𝑙 + 5 − 8𝑙 + 6 𝑙=0

  17. Algorithms > Considerations > Quality of Solution Will this algorithm generate valleys?

  18. Algorithms > Considerations Complexity

  19. Algorithms > Considerations > Complexity • Simple – 50 lines of code • Complex – 100,000+ lines of code

  20. Algorithms > Considerations Parallelization

  21. Algorithms > Considerations Processing Power

  22. Starting From Scratch

  23. Starting From Scratch (it’s a bad idea)

  24. Python Options

  25. Python Options Where to Look

  26. Python Options > Where to Look • Google code • Git • Forums • Technical books

  27. Python Options Licenses

  28. Python Options Evaluation

  29. Python Options > Evaluation Operations Research Tools Developed at Google http://code.google.com/p/or-tools/source/ browse/trunk/python/tsp.py?r=303

  30. Python Options > Evaluation > or-tools Runtime • Lines of code: 132 • Hardware availability

  31. Python Options > Evaluation > or-tools Quality of Solution

  32. Python Options > Evaluation Github user trevlovett Python Ant Colony TSP Solver https://github.com/trevlovett/ Python-Ant-Colony-TSP-Solver

  33. Python Options > Evaluation > Ant Colony TSP Solver Runtime • Lines of code: 132 • Hardware availability

  34. Python Options > Evaluation > Ant Colony TSP Solver Quality of Solution

  35. Optimization

  36. Optimization • Confirm implementation of algorithm as written • Check for most efficient coding practices

  37. Optimization • Use scientific package such as SciPy to rewrite code for speed • Break out select code into C routine

  38. Optimization • Parallelize – GPU – CPU

  39. Optimization Beware of fencepost errors and differences in hardware

  40. Web Resources

  41. Web Resources • The Stony Brook Code Repository , Concorde TSP Solver http://www.cs.sunysb.edu/~algorith/implement/concorde/im plement.shtml • TSP, github user denlunev, https://github.com/denlunev/TSP • Operations Research Tools , Google, http://code.google.com/p/or- tools/source/browse/trunk/python/tsp.py?r=303 • Ant Colony TSP Solver, github user trevlovett https://github.com/trevlovett/Python-Ant-Colony-TSP-Solver

  42. Bibliography

  43. Bibliography • Introduction to Graph Theory , 2 nd Edition, Douglas Brent West, Prentice Hall, 2000 • The Traveling Salesman Problem: A Computational Study , Applegate, Bixby, Chvátal & Cook, Princeton U. Press, 2007 • The Traveling Salesman Problem: A Guided Tour of Combinatorial Optimization , Lawler, Lenstra, Kan & Shmoys, Wiley, 1985 • The Traveling Salesman Problem and its Variations , Gutin & Punnen, Springer, 2002

  44. Bibliography • Combinatorial Optimization: Theory and Algorithms , 2 nd Edition, Korte & Vygen, Springer, 2002 • Combinatorial Optimization , Cook, Cunningham, Pulleyblank & Schrijver, Wiley-Interscience, 1997 • Local Search in Combinatorial Optimization , Aarts & Lenstra, Wiley, 1997 • Combinatorial Algorithms: Generation, Enumeration, and Search , Kreher & Stinson,CRC Press, 1998

  45. Bibliography • Counting: The Art of Enumerative Combinatorics , Martin, Springer, 2001 • Counting and Configurations , Herman, Kucera & Simsa, Springer, 2003 • Abstract Algebra , 3 rd Edition, Dummit & Foote, Wiley, 2003

  46. Thank You!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend