Re: EVOLUTION!!

Gerald de Jong <[email protected]> Thu, 13 May 2004 18:06:54 +0200
Newsgroups gmane.comp.graphics.fluidiom
Organization Beautiful Code BV
Message-ID <[email protected]>
On Thursday 13 May 2004 15:37, Karl Erickson wrote:
> Both the old and the new version were/are fine on my
> XP Pro machine.

finally!!  some good news.

> This is great stuff, Gerald!

thanks.  i'm going to be presenting it in Rotterdam on the evening of june 
11th with big screens and big speakers here at V2_ (www.v2.nl).

you're invited!  :)

> Could you elaborate the details of the evolution that
> is going on here? Maybe walk through your algorithm in
> pseudocode?

it works on the basis of interval contractions which are placed on different 
"minutes" of the "clock", and have specific widths in "minutes".  a 
contraction changes the rest span of an interval from 1.00 to 0.75.

a mutation is one of four things:
- move a random existing contraction to another "minute" in the cycle
- widen or narrow a random existing contraction
- add a new random contraction
- remove a random existing contraction

given any old fabric you've built, saved as XML file.... say "gumby.fabric".
future efforts may involve the evolution of the structures, but for the time 
being we can just build them by hand.  the evolution process runs through 
20-minute lifetimes in a half-second or less.

run the program with parameters "-evolve gumby.fabric", and it changes the 
file "gumby.fabric" to a directory "gumby.fabric/", and inside that 
directory...

prepare:
create 30 (arbitrarily chosen number) different mutations from the original, 
and store them under names corresponding to the distance they travel in their 
lifetime (x iterations).  result is 30 XML files with numbers as file names.

evolve:
loop {
	pick a random fabric file of the 30 files
	mutate the fabric
	run a "lifetime" of iterations on the fabric
	measure how far it has moved from (0,0).
	save the file with a name corresponding to this distance
		(unless it's worse than the worst one, in which case you discard it)
}

this way, a new record-holder stays around longest so it has the best chance 
of mutating/replicating.  still, a variety of mutations is present at any one 
time, so there's a chance that mutating one of the weaker ones may outperform 
the current record holder.

it's not exactly an ecosystem, and it's not sexual reproduction in any way, 
but the domain is sufficiently limited that my laptop can evolve an 
impressive beast overnight.

-- 
Gerald de Jong
Beautiful Code BV
Rotterdam, NL


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click