07 mars 2006

breeding figures

*** WARNING GEEK TALK AHEAD ***
I'm very proud to announce that I've finally managed to breed proper figures. LOL

I've been looking from afar at genetic algorithms for quite some time now, and I've decided to make the jump and try it a few weeks ago. Then my computer broke, I found other stuff to do and I only came back to it again a week ago. And now it works :D.

The principle is quite simple, very similar to breeding animals or flowers to achieve the most beautiful/resistant/sweet one. Professional breeders do that by mating the best specimens they have and the next generation is better than the previous one, usually. Choose the best of the new, and you get the creme. Choose again and voila, la creme de la creme.

Well, in short, I'm doing the same with figures that represent objects. Let's say I want to have the cheapest and sturdiest bridge depending on its thickness, its width and the material.
To start, the computer will design 30 bridges using formulae I've programmed.
Then it will give them scores: low for expensive and weak, medium for expensive or weak, high for cheap and sturdy.
Second, it will code the 3 parameters (thickness, width and material) into digital chromosoms and mate these chromosoms to produce 10 new bridges. Some will be better than the first generation, some will be worse, it's more or less random.
Third, it gives scores to the new ones, and includes them in the pool of bridges. The 10 worst bridges are discarded, and a new generation can be created from the 30 remaining.
Repeat 10 times or more, and you have "the perfect bridge", strong and cheap.


It works for everything, the NASA has used a similar approach to design an antenna to be mounted on a satellite Look here, it's been simulated on race cars to make them faster, and I do remember that a bridge somewhere has been designed that way (with way more parameters of course).

Well, am just soo happy it works :D I'll need to try it one something "real" as I've only tested it on a simple math function at the moment :D.
And then I can play with it, I haven't tried to induce mutations yet and I also need to test how many specimens and how many generations are needed.

4 commentaires:

tommpouce a dit…

lol, well it's nice to use my brain from time to time. I'm getting really interested in all this. I'd work in the Artificial Intelligence field with more passion than in planes I think.
Kinda weird huh :P

I'm sure you did something lol. Didn't you kick asses at the NSO? :p

tommpouce a dit…

Better not to infuriate the good people at NSO right :p

Anonyme a dit…

that is so cool! when can i try it out? I want to play, too!

Kala

PS. Julien made an application to make fractals using C++ (Visual Studio something or other)... did you use the same application too?

tommpouce a dit…

nah C++ is for winners :P
I'm using matlab, it's dedicated to engineering computation (meaning anyone doing C++ will laugh at me :p)

:-) Am not sure there's anything to be played with lol, it's just a boring piece of code, and there's nothing visual. Except if you love looking at graphs, maybe.

Next project, way more interesting and visual. I'll tell you about it later, when I've produced something.