Genetic Algorithms

Discussion in 'General Chatter' started by Exohedron, Jun 7, 2015.

  1. Exohedron

    Exohedron Doesn't like words

    boxcar2d.com
    I've accidentally gotten myself hooked on this again, so I might was well share it with you guys.
    Basic idea: A track, by which I mean a road with a lot of bumps and ditches and such, is generated randomly to start with. Then a bunch of "cars" are randomly generated, where a "car" just means a polygon with some wheels attached. The cars go along the track one at a time until they can't get past some obstacle or they fall apart, and then the cars are bred together, with the best performing ones having a higher chance of getting picked for breeding. The resulting car of a breeding pair is similar to its parent cars, in terms of the shape of the polygon and the number and size and arrangement of their wheels, although there is a small amount of mutation. This gives us a new generation of cars, which then attempt the same track.
    Repeat.
    It's a genetic algorithm that slowly gets cars that are adapted to the particular track. There's a surprising amount of pathos in watching these things over the generations as they get stuck on obstacles; they get so, so very close to success, and even though you know that this particular design hasn't been able to overcome that hill for the past however many generations, each and every time you have so much hope, only to see it inevitably dashed against the rocks. Again. Literally.

    My latest runthrough has been getting stuck in this one valley for over 30 generations.
     
    • Like x 3
  2. seebs

    seebs Benevolent Dictator

    That is really neat.
     
  3. TwoBrokenMirrors

    TwoBrokenMirrors onion hydration

    /immediately becomes invested in shouting advice at polygon cars
     
    • Like x 1
  4. Exohedron

    Exohedron Doesn't like words

    Editing this thread because I want to post another thing: Evolving chips

    There are a type of chips called FPGAs that aren't entirely hardwired; they have a bunch of logic gates but the connections between them can be changed. Such chips can be set for lots of uses, provided one can figure out what configuration to put them in.
    Dr. Adrian Thompson at the University of Sussex decides to see what kind of configurations get produced by a genetic algorithm.
    Player: an FPGA with 100 gates, no clock
    Task: differentiate between two audio tones
    100 gates is a lot smaller than one would normally use in a sound card, and with no clock how does the chip detect time?
    Thompson runs the chip through a genetic algorithm, first running 50 random configurations, then taking the best configurations and breeding them together with occasional mutations, running the result on the chip.
    After about 4000 generations, he got a configuration that when given a 1khz waveform would drop its output voltage to 0, and when given a 10khz waveform would raise its output voltage to 5V.
    Peering into the workings of the chip yielded a bunch of mysteries. Only about 37 of the gates were in use, and mostly in feedback loops. Five collections of gates were completely disconnected from the input and output, but if they were disabled the chip would entirely stop working. Also the configuration wouldn't work reliably on other chips of the same type.

    Anyway, more fun with genetic algorithms.
     
    Last edited: Nov 19, 2015
    • Like x 7
  5. Exohedron

    Exohedron Doesn't like words

    The old boxcar2d has died, due to Flash. Fortunately, someone has built an html5 version. Slightly different, but roughly the same idea: Genetic Cars
    I like that it displays a bunch of data and has a leaderboard.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice