Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
simulating_photosynthesis [2008-10-06 08:34] – created davegriffithssimulating_photosynthesis [2008-10-09 11:08] (current) davegriffiths
Line 1: Line 1:
-===Using genetic algorithms and l systems to make plants grow===+===Making plants grow towards light===  
 + 
 +Using lindenmayer systems and genetic algorithms to simulate plant growth. 
 + 
 +Plants are given a "fitness" based on their leaves -  
 +  * How much do they face the light?  
 +  * Are they too close to other leaves? 
 +  * Are they in shadow from another leaf? 
 +  * Are they below the ground? 
 +  * The fitness drops as the plant description (a linenmayer system string) gets too long.
  
 {{http://www.pawfal.org/dave/images/patab-angle-s.png}} {{http://www.pawfal.org/dave/images/patab-angle-s.png}}
 {{http://www.pawfal.org/dave/images/patab-close-s.png}} {{http://www.pawfal.org/dave/images/patab-close-s.png}}
 {{http://www.pawfal.org/dave/images/patab-occlude-s.png}} {{http://www.pawfal.org/dave/images/patab-occlude-s.png}}
 +
 +The leaf score is indicated by it's colour (red=bad, green=good).
 +
 +Using this measurement, a genetic algorithm can create populations of individual plants, score each one and iteratively create new populations by combining fit individuals.
  
 <html> <html>
 <embed src="http://blip.tv/play/AdGkH4_+Sw" type="application/x-shockwave-flash" width="640" height="480" allowscriptaccess="always" allowfullscreen="true"></embed>  <embed src="http://blip.tv/play/AdGkH4_+Sw" type="application/x-shockwave-flash" width="640" height="480" allowscriptaccess="always" allowfullscreen="true"></embed> 
 </html> </html>
 +
 +The simplest strategy is to "cheat" with one leaf :) Each frame is the fittest of a new population, the text is the current lindenmayer string.
  
 {{http://www.pawfal.org/dave/images/patab-long.png}} {{http://www.pawfal.org/dave/images/patab-long.png}}
 +
 +The result of a long run with many thousands of generations. Many leaves circle the light to get the maximum photosynthesis possible.
 +
 {{http://www.pawfal.org/dave/images/patab-helped.png}} {{http://www.pawfal.org/dave/images/patab-helped.png}}
 +
 +You can also evolve from a starting point - in this case a simple tree is modified to create a bigger and more suitable one for the environment.
 +
 +Code: http://www.pawfal.org/flotsam/jetsam/patabotany/scheme/
 +
 +<html>
 +<embed src="http://blip.tv/play/AdGkMo_+Sw" type="application/x-shockwave-flash" width="640" height="480" allowscriptaccess="always" allowfullscreen="true"></embed> 
 +</html>
 +
 +Another evolutionary run, a bit more interesting than the one-leaf approach.
  • simulating_photosynthesis.1223282079.txt.gz
  • Last modified: 2008-10-06 08:34
  • by davegriffiths