Evolving Solutions                                Machine Learning                         Programs that Search for Soluti...
Basic ConceptsMonday, January 14, 13                    2
Learning ==> Improvement                Some quality is being improved.                         There is some measure of g...
Learning ==>  Some quality is being improved.              Implies / Assumes:                         There is consensus a...
Searching for Better               Random Search                         Randomize values in degrees of freedom.          ...
Seeker: When do you quit searching?               Infinite Loop versus “Stopping Condition”               Eventually we run...
Faulty                         AnalogsMonday, January 14, 13             7
Evolution              There is some way to measure “fitness”              Fitness is a function of a set of objects       ...
Genetic Algorithm              Define degrees of freedom ==> genes.              Produce first generation with randomized ge...
Main Loop In SmalltalkMonday, January 14, 13                        10
Next GenerationMonday, January 14, 13                     11
MutationMonday, January 14, 13              12
Degrees Of FreedomMonday, January 14, 13                    13
See Also: Java Example                               for                       Traveling Salesman      http://code.google....
Insect (Swarm) Behavior             Swarms search for “food” / Encounter “intruders”             -- mostly random search. ...
Particle Swarm Optimization             Mixed Analogy: Particle <==> Flying insect.             Particles have “position” ...
http://vimeo.com/17407010Monday, January 14, 13                  17
Stopping Conditions             How good is good enough?             Genetic Algorithms and Particle Swarm Optimization   ...
Simulated Annealing               Concept: Temperature ==> Energy Available.                         Energy ==> speed of m...
Gotcha’s             Experts refuse to say “optimum / optimal / optimized”                         No way to verify soluti...
Visualization             How do you visualize position in hyperspace?             Assign each degree of freedom to some g...
http://megaswf.com/serve/Monday, January 14, 13                   22
Lessons Learned             I did not and do not expect this to work.             It is just something I always wanted to ...
Upcoming SlideShare
Loading in...5
×

Genetic algorithms

992

Published on

Presentation for CraftmansGuild on 15-Jan-2013. Genetic Algorithms, Simulated Annealing, Particle Swarm Optimization.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
992
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Genetic algorithms

  1. 1. Evolving Solutions Machine Learning Programs that Search for Solutions Searching Random Points Recursive Descent / Ascent Sub-Optimization Faulty Analogies Fitness Genetic Algorithms Particle Swarm Optimization Simulated AnnealingMonday, January 14, 13 1
  2. 2. Basic ConceptsMonday, January 14, 13 2
  3. 3. Learning ==> Improvement Some quality is being improved. There is some measure of good / bad. There is some way to move toward good. Change position Change behaviorMonday, January 14, 13 3
  4. 4. Learning ==> Some quality is being improved. Implies / Assumes: There is consensus about good versus bad. There is some way to measure good / bad. Give that measure a name: “Fitness” Analogy to nature and evolution concept.Monday, January 14, 13 4
  5. 5. Searching for Better Random Search Randomize values in degrees of freedom. Compare resulting fitness. Pick the best results. And then what? Recursive Descent / Ascent Assumes that solution space has a gradient. Assumes there are minima / maxima.Monday, January 14, 13 5
  6. 6. Seeker: When do you quit searching? Infinite Loop versus “Stopping Condition” Eventually we run out of time / resource / energy. Complications: Sometimes “Best” is not well-defined. The solution space is continuously changing. The shape (gradient qualities) of space is unknown.Monday, January 14, 13 6
  7. 7. Faulty AnalogsMonday, January 14, 13 7
  8. 8. Evolution There is some way to measure “fitness” Fitness is a function of a set of objects that can vary over individual instances. Call the objects “genes” to use genetic analogy. Mutation ==> Changing the values of “genes”. Sexual Reproduction ==> Merging gene “sequences.” Next Generation <== keep most fit, cull least fit.Monday, January 14, 13 8
  9. 9. Genetic Algorithm Define degrees of freedom ==> genes. Produce first generation with randomized genes. Evaluate fitness of each individual Calculate / Run a simulation of environment. Keep most fit <==> Cull least fit. Populate the next generation. ( mutate and/or splice ) Repeat until “done” Note: Real environments change over time.Monday, January 14, 13 9
  10. 10. Main Loop In SmalltalkMonday, January 14, 13 10
  11. 11. Next GenerationMonday, January 14, 13 11
  12. 12. MutationMonday, January 14, 13 12
  13. 13. Degrees Of FreedomMonday, January 14, 13 13
  14. 14. See Also: Java Example for Traveling Salesman http://code.google.com/p/java-traveling-salesman/ source/checkoutMonday, January 14, 13 14
  15. 15. Insect (Swarm) Behavior Swarms search for “food” / Encounter “intruders” -- mostly random search. Insects communicate with their buddies. Their buddies re-direct their paths to gather / fight.Monday, January 14, 13 15
  16. 16. Particle Swarm Optimization Mixed Analogy: Particle <==> Flying insect. Particles have “position” in multi-dimensional space. Assign each particle to a group “swarm” (at random). After fitness is evaluated, particles move toward the most fit particle in their swarm. The most fit particle in the swarm can stay where it is, ascend, or dither (random move). Recursive ascent / descent may guide moves if the space is believed to be reasonably continuous.Monday, January 14, 13 16
  17. 17. http://vimeo.com/17407010Monday, January 14, 13 17
  18. 18. Stopping Conditions How good is good enough? Genetic Algorithms and Particle Swarm Optimization can provide multiple solutions. Stop when best fitness is no longer improving. Stop when move method is no longer moving anything. Stop at some arbitrary limit: Number of generations. Time limit.Monday, January 14, 13 18
  19. 19. Simulated Annealing Concept: Temperature ==> Energy Available. Energy ==> speed of movement. Speed == How much change from step to step? Annealing == Cooling at controlled rate ==> The allowed change decreases from step to step. Stopping Condition: Temperature (Change/Step) goes to zero. Other stopping conditions may also apply.Monday, January 14, 13 19
  20. 20. Gotcha’s Experts refuse to say “optimum / optimal / optimized” No way to verify solution is best possible. Parameters selected may not cover everything. Say “sub-optimal” or “satisfices” (good enough) Solution is only good inside your simulation. Real world is certainly different. Don’t over-train: Solution may lack flexibility.Monday, January 14, 13 20
  21. 21. Visualization How do you visualize position in hyperspace? Assign each degree of freedom to some geometry. 3 degrees (x,y,z) ==> position 2 degrees (angle, angle) ==> orientation of “axis” additional degrees ==> shape dimensions Example: Torus (donut) Shape -- 9 shape dimensions Radius, Eccentricity, Angle (?), r, e, a frequency of: twist, wave, bulgeMonday, January 14, 13 21
  22. 22. http://megaswf.com/serve/Monday, January 14, 13 22
  23. 23. Lessons Learned I did not and do not expect this to work. It is just something I always wanted to tinker. Best fitness for 2007-2008: Stay out of the market! “When-to-buy” was competing with “when-to-sell” and producing counter-productive results. ==> Need more complex strategy ==> more parameters. Very compute intensive (generation takes way too long) ==> Need faster data structure ==> Refactor database. ==> Squeak VM is single-thread ==> Port to Erlang ??? ==> Potential GPU application.Monday, January 14, 13 23
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×