[HN Gopher] Watch cars evolve using genetic algorithm
       ___________________________________________________________________
        
       Watch cars evolve using genetic algorithm
        
       Author : memalign
       Score  : 243 points
       Date   : 2024-04-27 05:46 UTC (1 days ago)
        
 (HTM) web link (rednuht.org)
 (TXT) w3m dump (rednuht.org)
        
       | gus_massa wrote:
       | Old discussions:
       | 
       | https://news.ycombinator.com/item?id=5942757 (664 points | Jun
       | 2013 | 169 comments)
       | 
       | https://news.ycombinator.com/item?id=10600486 (162 points | Nov
       | 2015 | 57 comments)
        
       | gavinsyancey wrote:
       | So boxcar2d, but without flash.
       | 
       | https://news.ycombinator.com/item?id=2196747
        
         | robotnikman wrote:
         | I knew I had seen something like this over a decade ago!
        
           | gield wrote:
           | This html5 version has also been around for longer than a
           | decade already. It's what inspired me to take a class on
           | Genetic Algorithms and Evolutionary Computing in university
           | back then.
        
         | KennyBlanken wrote:
         | ...and apparently all the suspension parameters stripped out
         | for some bizarre reason.
         | 
         | The physics simulation clearly uses inelastic collisions, which
         | is wildly unrealistic and why so many otherwise passable 'cars'
         | don't pass the course. Also seems to use a very low coefficient
         | of friction - most of my cars couldn't make it up a two-
         | segement slope.
        
       | dustfinger wrote:
       | > evolve random two-wheeled shapes into cars over generations
       | 
       | Where I come from, we call two-wheeled automobiles motorbikes.
       | Very cool simulation though!
        
       | xuhu wrote:
       | Btw, how much AI goes into designing the exterior of a car
       | (panels, lights, windows, grill) ? Can they just drag a slider
       | for "How much muscle do you want" from "Yes" to "Beige" ?
        
         | AlotOfReading wrote:
         | Very little. It's heavily computer aided, but the overall
         | design is largely done by humans with some marginal input by
         | engineers for annoying realities like aerodynamics and sensors.
        
         | speedgoose wrote:
         | I don't think they use generative AI much in automotive design
         | today, but you can play with stable diffusion and embeddings
         | and make a slider for muscle cars in the textual weights.
        
       | hinkley wrote:
       | Why are the cars so spiky and why do they stay that way? Mostly
       | what I saw was the wheels move and change size.
        
         | Delk wrote:
         | 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 stability, but with the shape between the wheels being
         | concave for clearance. That doesn't quite seem to happen,
         | except for the concave clearance to an extent.
         | 
         | Maybe the rest of the shape doesn't really matter for the
         | simulation, so there's no selective pressure towards not having
         | a spiky shape.
        
           | hinkley wrote:
           | Both runs I did the cars looked like a child drawing a car
           | from Mad Max.
           | 
           | My best guess is sort of adjacent to yours: a lot of cars
           | flip on the initial drop and I think the spikes are helping
           | them land right side up. Overfitting T=[0,1]
        
       | jmole wrote:
       | this is fun, even though the speed controls aren't super
       | intuitive. You can press "Surprise" to speed things up and go
       | through a bunch of iterations quickly.
       | 
       | The mutation rate (likelihood that g changes) and mutation size
       | (Dg) are fun hyperparameters to tweak while watching the
       | population evolve over time.
       | 
       | It would be interesting to see a gene for "compliance" so the
       | cars could have some kind of suspension. EVerything more or less
       | evolved into a sort of tron-bike shape for most of the runs I
       | tried.
        
         | canjobear wrote:
         | > EVerything more or less evolved into a sort of tron-bike
         | shape for most of the runs I tried.
         | 
         | I ran it in the background for a very high mutation rate for a
         | long time and it managed to come up with something very
         | different---a little wheel attached to a big wheel, which
         | bounces around and goes over all the obstacles.
        
       | dexderp wrote:
       | 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?
        
       | pjs_ wrote:
       | I wrote the original version of this nearly 20 years ago. Cool to
       | see it still pop up here from time to time.
       | 
       | Still runs in the browser thanks to Ruffle:
       | 
       | https://peteshadbolt.co.uk/posts/ga/
        
         | b800h wrote:
         | On Firefox here, the "Save Local Population" option seems to
         | crash. Any idea why that might be happening? (Amazing site btw
         | - every time it pops up I end up spending much too long with
         | it).
        
         | s1k3s wrote:
         | What would be the consequences of adding a hitbox on the
         | structure (or springs?) as well, as opposed to having it only
         | on the load?
        
         | CasperH2O wrote:
         | Do you have some examples of results when running this for a
         | few days?
         | 
         | Or perhaps, 20 years? ;-)
        
           | nickpsecurity wrote:
           | Or another civilization wrote it a few, billion years ago. We
           | might see the results fly by our planet this week.
        
       | Genbox wrote:
       | It references Box2D as the physics engine, but it seems to be a
       | JavaScript port of Box2D. I'm unfamiliar with the JavaScript
       | ports, but if it is a copy of one of the existing ports, the port
       | should be referenced instead.
        
       | iancmceachern wrote:
       | Reminds me of that game Detroit
        
       | logicprog wrote:
       | I spent _hours_ as a kid playing with Boxcar 2D. This brings back
       | memories, and I 'm not even that old!
        
       | jeffbee wrote:
       | Or "overfitting as a service".
        
       | lwansbrough wrote:
       | How many generations does it take to start destroying
       | communities? :)
        
       | Applejinx wrote:
       | 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 ;)
        
         | drooby wrote:
         | Why is this not a genetic algorithm? Genetic evolution does not
         | require crossover.
        
       ___________________________________________________________________
       (page generated 2024-04-28 23:00 UTC)