3.6 Project3 : Evolutionary Algorithms
3a: Setting up
As before,
work in a new directory (3/a) and start by exporting my code from my (3/a).
What to do:
-
Get Conrad’s code running for 5,000,000 days. See if you can confirm (or deny) the graph on p217 (i.e. do we tend to
evolve two breeds)?
-
Code an extension to Conrad’s evolution.lisp file (it is in 3/a). Do *not* run the extension- that is for next week.
But to code this extension, you have to understand how to hook into Conrad’s code.
Note that your new code can contain deftests, even if it does not run.
Note that you can generate distributions using simple ascii graphics (see the dist
function
in 3/a’s tricks.lisp
). e.g.
> (dist '((apple . 30) (dogs . 40) (beds . 20)))
******************** : BEDS
****************************** : APPLE
**************************************** : DOGS"
In this extension, animals have four preference wheels
(right now, they only have one: genes). One of them controls direction (taken from the current code).
Wheels two and three
controls what happens
when two animals are side my side. For these two wheels, the zero pos is aligned to neighbor and then the animal
moves in a direction according the weights in that wheel (so this overrides the current wheel in Conrad’s code).
Wheel two controls same gender meetings and wheel tree
controls different gender meetings. Moving in position 0 means "stay".
-
If different genders "stay" then they mate,
(if their energy is above *reproduction-energy*), losing half their energy to their kid (so the kid
gets two lots of energy from mummy and daddy).
As with Conrad’s current game, the wheels from mummy and daddy mutate and pass to the kid.
Each wheel is passed separately (so their genes do not mingle).
But now, mummy and daddy’s genes combine before passing (using two-point crossover).
-
If same genders "stay" then they fight. Each animal expends a random amount of their remaining energy on the fight,
controlled by wheel four.
The one who expends the most energy lives and the other dies.
If an animal has more than two neighbors, then a random pair is picked at the others are ignored.
What to hand-in:
-
For the as-is game: a graph like p217 and a text file commenting
on whether or not we got two breeds.
-
For the new game : a new version of evolution.lisp with the new code installed and lots of comments
describing its behavior.
3b: Baselining
As before,
work in a new directory (3/b) and start by exporting my code from my (3/b).
WARNING: this is an exploratory project for code that has never run before. I have
no idea what will happen when they new, sexed-up, animals get running. So there is
an X% chance that all your animals will instantly die and we’ll have to think about
the direction of this project.
Anyway, enough hedging...
What to do:
-
Get your code running from 3a.
Remember to run things with nice -n 20 (as done in ‘go’).
-
Optimize your code. For a small number of days (say 100,000) run evolution inside
the
watch
command in tricks.lisp. See if you can find any hotspots that can be optimized.
-
Run your optimized system for 5,000,000 days (and if that is too slow, go for smaller numbers).
Generate distributions for the preference wheels. See if you can find
multiple species evolving in this space.
What to hand in:
- All you code, deftests, as per usual.
-
The results from watch, see if you can see a hotspot also a text file
commenting on the hot spots, and what you can do about it.
-
Your distributions see in point 3 (above) as well as a text file commenting on the distributions that
you see.
3c: Improvements
In the GA lecture, there are some standard settings for GAs:
All generalities are false. But, just to get you started:
-
Population size: 50
-
Number of generations: 1,000
-
Crossover type: typically two point
-
Crossover rate: 60%
-
Mutation type: bit flip
-
Mutation rate: 0.001
Using the new sexier animals, see which (if any) of the above matter.
You’ll need to define a success function: minimize population variance over the generations
while increasing population and life expectancy,
What to hand in:
-
All your code and deftests, as before.
-
A pdf report (*no* MS-WORD) that defines all the above 6 items and shows the effect of altering
them on your animal population, population variance, population life expectancy.
Cool graphics
please! That report should have all the names of the team members on page 1
and include a recommendation about what settings are best for your species.
This document was generated on March 1, 2011 using texi2html 5.0.