View Full Version : Evolution
Aepervius
2nd February 2008, 12:00 AM
Hi All,
I am reading the blind watchmaker, the chapter where Dawkins present his evolution programs (the one which build the various graphics).
Since I like to programs (I and like to fool myself into thinking I am a not-too-bad one) but I am a poor biologist, I decided to make a similar programs just for fun.
The programs will have a world filled with various being , all having a genetic code.
The being (let us call them biomorph (*cough*)) have various property : speed, maximum energy reserve, how do they eat (photosynthese, carnivore, omnivore), fur thickness (protection against cold), maximum perception, camouflage etc...
Each of those property are linear but consume more energy in an exponential way. For example if you have the double speed of the "normal neutral" species , you consume 4 time the energy.
The world will be defined by a gradiant of high light at the equator (bring lot of energy for photosynthese and is warm) and low light (not much energy and is cold).
Each of those property above are linked to genes. The more the gene is present, the more the expression will be. There will also be negative genes (for example making you slower).
The genetic code will be a string of characters. Each genese being one character.
For example if neutral normal speed is A, and negative speed (50% slower, 1/4 of metabolism) is B, and positive speed is C (200% speed, 4 time energy requirement) and a genetic code is 00000A00000000C0000C000B my biomorph can reach if necessary double speed. I will also add limitation that a gene can be at most expressed to a factor 3 (so CCCCCCCC is equivalent to C).
One serie of gene will code the feeding process (carnivore for 1 specy, carnivore for many specy, omnivore (eat both carnivore and photosynth) , and ominovore cannibal.
Reproduction will only be allowed if the energy reserve are above a factor. biomorph eating other biomorph will get their energy reserve multiplicated by a factor.
I will start with neutral biomorph (same speed , photosynthesis, neutral gene all along).
Then will allow to mutate each 5 or 10 generations.
I am really curious at what I will get in the end. What do you think of the idea ? Any suggestion ?
PS: I assume some people already programmed such things. But the goal is NOT to use what somebody else programmed, but to do one myself as realistic as possible and see if I can get selection pressure.
Dancing David
2nd February 2008, 03:54 AM
You might want to break up the energy usage, unless that is something you really want. Speed for example, I can understand why you would want to have a horse or cheetah pay a very high cost for very high speed. This would represent the idea that they can run for only a short period. Some critters however have already paid such a high cost for locomotion (human bipedalism) that there is essentially no penalty for high speed.
So, perhaps for some things, such as camouflage there would be a low to moderate cost (minor shifts in the genome) and then some critters would have reduced penalties for changes.
So you could do it a number of ways, there could be an overall cost factor in critter generation or there could be a random factor where some changes come at high cost and others come at a reduced cost.
Sounds very cool.
Dymanic
2nd February 2008, 07:16 AM
I did one once which was very much like what you've described (sorry about that). It was essentially a sooped-up version of the classic "snake" game (I called them "worms"). I wanted to avoid explicitly defining attributes as much as possible, but to let them emerge naturally instead, so what I ended up doing was using color to represent energy. Individual worms could metabolize different colors to different degrees, and all it took to turn an "herbivore" into a "carnivore" was for it to encounter another worm whose color was on its list of edibles.
As DD suggests, I made them pay a price for things like speed or good vision. Each worm had an allotment which could be distributed across a range of attributes, but which couldn't exceed a certain limit, that limit itself being determined by an attribute: the maximum tail length the worm could achieve. Since a worm could not breed until it had grown to its maximum length, the slower breeding rate was the price for having fancy equipment. In a later version, I supplied "food" for my worms by writing in a population of plants. These worked quite a bit differently from the worms, but they also had attributes and had to compete for survival. With their branch lengths and angles, the plants actually resembled simple Dawkins biomorphs with leaves added on.
Obviously, I was hoping to see fancy and exotic worms evolve, but it turned out to be pretty rare. The tendency was toward short-tailed fast breeders, and the plants inevitably moved toward short branches with sparse leaves (as this made them less vulnerable to being eaten). The most interesting result occurred before I realized that it was necessary to make an exception to my "no explicit rules" rule where auto-cannibalism was concerned. If I let the thing run for any significant length of time, I'd always return to find nothing but clusters of self-sufficient cannibals. (This is partly due to the unfortunate fact that since there is always an upper limit to system resources, there is always a maximum population size.)
Of course, while I found my effort rewarding in its own way, it was a long way from what Dawkins was clearly hoping for with his appeal to the "programmers of those noisy and vulgar arcade games". I realized that to bring his biomorphs to life by replacing the artificial selection with natural selection, what's needed is a physics engine. I had just enough of a go at that to gain a better appreciation for what's involved in writing a physics engine, and I realized soon enough that I wasn't likely to be breaking any new ground there:
http://sodaplay.com/
http://www.wired.com/wired/archive/12.01/stuntbots.html
shadron
2nd February 2008, 07:34 AM
Take a look at this: http://www.youtube.com/watch?v=mcAq9bmCeR0
Aepervius
2nd February 2008, 09:57 AM
Dynamic, Dancing David, I understand the argument, and I think I will do it both way. I anyway forsaw to have a matrix to easily set up cost in energy , so cost=zero is one of the example. I would like to see what the difference are when there is a cost associated. I will insert also some code to have development cost (in addition to of usage cost) as I think you suggest. Later I can set any cost to zero or some number and let the simulation run.
I had forseen to limit myself to asexual reproduction due to the easiness of implementation (reproduction = scission in two or more individual, with a % chance to have an error in the genetic code). I may change my plan to add both form of reproduction, albeit without the "search for mate" (just take at random the one nearest something similar...).
Thanks for the input & video.
PS: the energy resource is unlimited to the photosynthetiser (sun) and they are not carnivore. If a carnivore/omnivore take over and kill all photosynthetiser, then my virtual world will go in a death spiral, as they will not find any other energy source and die out of hunger.
Dymanic
2nd February 2008, 11:57 AM
I kept reproduction asexual for exactly the reason you stated. And the "death spiral" is an outcome that will happen; in fact, if your program is a good model, it should happen at least some of the time. It happened so often in my program that I ended up creating a user interface that enabled the artificial introduction of new organisms, as well as on-the-fly twiddling of global values for growth rates, mutation rates, etc. I also used a "decay" feature which was sort of the reverse of the "photosynthesizer". It randomly selected a pixel which was then deleted, unless it happened to be a worm (in which case it did nothing), or a seed from one of the plants (in which case it incremented that seed's germination counter instead). That way, orphaned fragments and old junk got cleaned up automatically.
Mine was essentially a pixel engine, which is one of the reasons I kept bumping into resource limits, especially when using a large screen size. I guess another reason is that use of system resources tends to be inversely proportional to the amount of elegance in the coding. If the goal is a robust modelling of biological evolution rather than eye candy, there are surely a million different approaches that would be better than the one I used. For instance, I thought of letting most of the action run out of view, maybe even rotating through chunks of data selected from an environment (possibly huge) existing mostly on disk. I decided it would not significantly increase the value of what I had done, however, so my end product remains basically a screen saver. But it really was a lot of fun, and I learned a lot about coding (mostly about what not to do) and about biology as well, I think. Writing it forced me to confront some aspects of the biology in new ways and in greater detail.
Please keep us informed as to your progress. And be careful with that sodaconstructor thingy. It can be a real time sink.
Aepervius
2nd February 2008, 01:54 PM
I'll make sure to keep you updated. Right now I am not doing something really efficient (creating a pointer of roughly 120 byte per biomorph, it is actually a class) but my estimate is that the CPU will run out before the memory ;).
Point taken on the hability to seed on the fly and/or change the parameters.
For the graphic display I will limit myself to pixels too, and most probably not every "time" units of the simulation.
I have the strange feeling I am recreating simearth (for those which remember the game).
Shoogar
2nd February 2008, 07:14 PM
You guys are beyond me....but here is a program I play with. It's a free download.
http://www.swimbots.com/
Aepervius
4th February 2008, 03:50 AM
I made quite a progress:
Firstly I defined my genes mapping (which genes map to which "base string list", which
also define the probability of arising) then defined positive and negative effect.
So de facto you can get a better eye sight, but random chance alone can also give you
worst eye sight. That is, if there was not a pressure to get a better eye sight.
The list is as following (the negative gene do the same in the other direction) :
* Eyesight : allow greater range and better detection probabilities
* camouflage : allow to lower detection probability
* fat : increase weight and energy consumption but increase reserve
* speed : increase energy consumption and speed
* legs/jump : enable to turn quicker right/left
* offspring number : increase number of offspring at the cost of offspring robustness
* offspring frequency : increase offspring generation frequency
* fur : lower/higher temperature prefered (the more you are away from the
prefered temperature the higher the metabolic cost).
* behaviour genes (how the animal reacts. I know that it is also msotly learned, but I
can't really put learning from the ehrd at the point, so I make it a gene).
* age (higher age, means coming to reproducing age later and slightly lower offspring
frequency, lower age means quicker coming to reproducing age and slightly higher offspring frequency)
The mapping also say how frequent are the gene coding for those traits are.
ALl gene can be activated or deactivated globally separatly.
The I have a cost Map. It says what the effect of each genes is (for example
you can make eyesight less good or better at the same cost) and the cost
(for the same type of eye sight make it more costly or less costly). Both
parameter plays a role.
Finally I have got an environmental setup.
The world is a cylinder. YOu can define a highiest and lowest temperature and then
either use a vertical gradiant of temperature (highiest temperature at equator
and lower temperature at pole). Or use a color map with the highiest
blue color component being equal to the lower temp, and the highiest red color component
being equal to the highiest temp. Green component ignored.
There is also an environmental obstacle to sight mapping. You Define in %
the lowest visibility (0%, 25%....) and the highiest visibility. Then you either choose
a vertical line, and on the cylinder that line will be the lowest visibility,
the opposite line the highiest visibility, and a gradiant in between. It stays
then locked. Or you can use a grayscale picture mapping to define area.
The final mapping say whether it is possible to physically possible to go
in an area or not. This mapping has advantage of being able to define situation
where you had a gradiant, then load a new mapping with a sudden changed local area
and see how it all evolve. A bit like isolating a specy and give it other
environmental condition for a few 1000 generation then releasing it.
It is shapping up. The only things I regret right now is that it would be too complicated to
insert new gene with all sort of other weird effect and see how it change the simulation. I will have to change code for this...
Dymanic
4th February 2008, 08:35 AM
The only things I regret right now is that it would be too complicated to insert new gene with all sort of other weird effect and see how it change the simulation. I will have to change code for this...Good luck with that. I think what you're describing may ultimately turn out to be a rather formidable barrier. It's one thing to create a pre-defined environment which constitues the "search space" for solutions to a given problem -- and quite another to write a program capable of creatively defining or re-defining a problem on its own. Even if you succeeded, there would be no guarantee that it would do it in a way you'd find meaningful. You'd probably be lucky to even figure out what was going on.
Monza
4th February 2008, 11:53 AM
Take a look at this: http://www.youtube.com/watch?v=mcAq9bmCeR0
I hope this doesn't get overlooked. Take the time and watch this video.
ImaginalDisc
4th February 2008, 12:15 PM
Each of those property are linear but consume more energy in an exponential way. For example if you have the double speed of the "normal neutral" species , you consume 4 time the energy.
Well, in the real world a lot of organisms take advantage of speed by moving very little, or sometimes not at all. Filter feeders take advantage of currents that move food to them, which is pretty darn efficient as long as the flow doesn't stop.
Impalas are more efficent at their top speed than cheetahs are, allowing impalas to outrun the cheetahs as long as they have a reasonable head start. Their efficeincies have varied in evolutionary history in a sort of arms race where speed matters, but so does endurance, efficiency, and other factors.
Even migrating fish and birds take advantage of currents in pursuit of food. In your "simple" sim there aren't that many natural resources to exploit. Add a few things, like food that drifts in one direction for example, and you might end up with some familiar or weird things.
Aepervius
4th February 2008, 12:18 PM
I watched it. Nice isn't it ? But the interest in this project I am doing is : 1) I program it myself so I specify what It can do or not do 2) I can experiment around a bit. A bit like recreating simearth :).
© 2001-2009, James Randi Educational Foundation. All Rights Reserved.
vBulletin® v3.7.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.