Monday, February 27, 2012

Evolution

Forget, for the moment, the technical issues surrounding the following exercise.  I suppose, it can be run using a shell script, perhaps, but anyway...  Let's run some computational experiments on evolution.  Consider the following.  You wish to write a series of programs that do the following things to test evolutionary processes:


  • Load it's own source code into memory.
  • Search on the Internet (or through a large database) to find ways to make the program faster.
  • Copy the new lines of code into the source code, and write it into a different file.
  • Compile the new source code.
  • Run the new code.
If the new code doesn't compile, then that "species" dies out.  If it does compile and run, then the new code starts repeating the cycle above again, finding new code to implement into it's source and recompiling it's new children.

Essentially, you will create a series of programs that try to reprogram themselves.  You will, in a way, create a new "ecology" populated by running computer programs.... (you could even go so far as to say that the "programming language" is the haploid part of the the life cycle and the running program is the diploid part)

You can measure how quickly a certain lineage evolves over time, how quickly it can reproduce itself, how complex (over time) the program can become.  And you could even try other variations, by adding limited resources to be shared within a community, or other needs that must be performed prior to reproduction.  

Supposed you introduced sex.  One running program encounters another running program and loads their source code as well as its own.  You could either pick out the best parts of both and load that into the next generation, or (supposedly like modern biology does it) at random, with half from the "mother" and half from the "father".

What about cannibalism?  Can a machine write code that not only makes itself more efficient, but also delete source code from other competing programs?  Initially, I would have said"no", there wouldn't be any evolutionary advantage, but what if there were something outside of the program that might cause it to compete.... an "environment" if you will....  

I'll bet someone has already done this.... I'm too lazy to search for it, though...

Enhanced by Zemanta

No comments:

Post a Comment