Live data from Hacker News

Watch cars evolve using genetic algorithm

rednuht.org

41–50 of 76 posts

Re: Watch cars evolve using genetic algorithm

#41
post #10

Interesting. Is there a way to do this in a 3d physics based simulation environment. It would be cool to see if a genetic algorithm could be used to discover new aerodynamic configurations for drones/other platforms in simulation. I don't know enough about genetic algorithms to say for certain. Anyone have any reference materials for someone that's just started looking into this?

It’s the simulation and fitness function that are difficul not the genetic algorithm really.

I’ve done a bunch of playing around with NEAT, a variant of GA using NNs, for various things. Typically for GA stuff though you have a genome, aka some set of instructions for an individual, a fitness function for scoring them, and then you generate new individuals from those genomes for the next population.

Original Paper on NEAT here:

https://nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf

Lots of good resources here.

https://nn.cs.utexas.edu/

Re: Watch cars evolve using genetic algorithm

#43

It seems to always get into a rut where one design lucks out and dominates generation after generation, with no mutations producing anything even close to working. Like, the top ten don't change after hundreds of generations. Maybe this is just an attribute of genetic algorithms. They quickly zero in on something kind of good, and then get stuck at this local maxima. Or maybe I need to just play around with the Mutat…

More improvement needs wild environment changes.

Re: Watch cars evolve using genetic algorithm

#44

It seems to always get into a rut where one design lucks out and dominates generation after generation, with no mutations producing anything even close to working. Like, the top ten don't change after hundreds of generations. Maybe this is just an attribute of genetic algorithms. They quickly zero in on something kind of good, and then get stuck at this local maxima. Or maybe I need to just play around with the Mutat…

If you keep going long enough they'll probably turn into crabs.

Re: Watch cars evolve using genetic algorithm

#47
post #10

Interesting. Is there a way to do this in a 3d physics based simulation environment. It would be cool to see if a genetic algorithm could be used to discover new aerodynamic configurations for drones/other platforms in simulation. I don't know enough about genetic algorithms to say for certain. Anyone have any reference materials for someone that's just started looking into this?

It’s the simulation and fitness function that are difficul not the genetic algorithm really. I’ve done a bunch of playing around with NEAT, a variant of GA using NNs, for various things. Typically for GA stuff though you have a genome, aka some set of instructions for an individual, a fitness function for scoring them, and then you generate new individuals from those genomes for the next population. Original Paper on…

I love the NEAT algorithm. I did version of it for my senior project in high school, and have done a few iterations since, mostly with bugs that eat food and avoid predators. I'm about due for another round.

Re: Watch cars evolve using genetic algorithm

#49

This isn't genetic algorithm, though. It's mutation. To do it with a serious model of a genetic algorithm, you need crossover, not mutation. It's fun, but this is sort of a lottery of randomized cars with some capacity for copying winning ones over to successive runs. Breed the cars ;)

It does have crossover, doesn't it?

There's a GitHub link at the bottom which gives us this:

https://github.com/red42/HTML5_Genetic_Cars/blob/master/src/...

And that seems to call into createCrossBreed() in here:

https://github.com/red42/HTML5_Genetic_Cars/blob/master/src/...

And that gets a parentChooser callback, which seems to be cw_chooserParent() from here:

https://github.com/red42/HTML5_Genetic_Cars/blob/master/src/...

And that has some swap points and a thing that toggles between parents when some index matches one of two values.

I'm not really a JS programmer or a GA expert, but it looks like crossover to me.

Re: Watch cars evolve using genetic algorithm

#50
post #16
post #7

Why are the cars so spiky and why do they stay that way? Mostly what I saw was the wheels move and change size.

Looks like their shape is always defined by eight triangles. The page doesn't say what the genome defines about those triangles (only that there are eight vertices in the genome), but if it's just random angles and distances, it'd kind of make sense that they start as random spiky shapes. I don't know why they stay that way. My first thought would be that it might be beneficial for the shape to be relatively low for…

A big spike sticking out the top could change the center of mass and the moment of inertia. Both of those could affect how the car handles even if the spike never touches anything.

Oh, and they can affect the mass. If the grip of the wheels takes into account the normal force, extra weight may help with traction.

Hmm, and a 4th thing: some cars have a spike sticking out back behind the back wheels. These spikes sometimes function like wheelie bars, which are used on drag racers to prevent the car from flipping if the front end lifts off the ground. The wheelie bar kind of braces it but also lifts the traction wheels off the ground so they stop rotating it at the wrong moment.

Post reply on HN