Evan Sheehan | Project 3 | Science!

by Evan @ 6:28 am 1 March 2012

On the Origin of Egg Drops

I’m not entirely sure where the idea for this project came from. I was exploring several ideas for using flocking algorithms when I suddenly thought of evolving solutions to the egg drop problem using genetic algorithms.

[vimeo=http://vimeo.com/37727843]

I recall performing this “experiment” more than once during my childhood, but I don’t think I ever constructed a container that would preserve an egg from a one story fall. There was something very appealing about revisiting this problem in graduate school and finally conquering it.

Grab the code.

Physics in Processing

[vimeo=http://vimeo.com/37725342]

I began this project working with toxiclibs. It’s springs and mesh structures seemed like good tools for constructing an egg drop simulation. It’s lack of collision detection, however, made it difficult to coordinate the interactions of the egg with the other objects in the simulation. On to Box2D…

Box2D made it pretty easy to detect when the egg had collided with the ground. Determining whether or not the egg had broken was simply a matter of looking at its acceleration, and if that was above some threshold (determined experimentally), it broke.

Genetic Structure

What interventions can you make to preserve an egg during a fall? The two obvious solutions are 1) make the egg fall slower so it lands softly and 2) pack it in bubble wrap to absorb the force. These were two common solutions I recalled from my childhood. I used a balloon in the simulation to slow the contraption’s fall, and packing peanuts inside to absorb the impact when it hits the ground. This gave me several parameters which I could vary to breed different solutions: bouancy of the balloons to slow the fall; density of the packing peanuts to absorb shock; packing density of peanuts in the box. Additionally, I varied the box size and the peanut size both of which affect the number of peanuts that will fit in the box.

I also varied the color of the container, just to make it slightly more obvious that these were different contraptions.

Evaluating Fitness

My baseline for evaluating a contraption’s fitness was how much force beyond the minimum required to break the egg was applied to the egg on impact. A contraption that allowed the egg to be smashed to pieces was less fit then one that barely cracked it. To avoid evolving solutions that were merely gigantic balloons attached to the box, or nothing more than an egg encased in bubble wrap, I associated a cost with each of the contraption’s parameters. Rather than fixing these parameters in the application, I made them modifiable through sliders in the user interface so that I could experiment with different costs.

1 Comment

  1. this is a cool idea. I like that your program can vary so many factors. This is both useful and creative.+ 2
    what does the “1” in the top right of the video
    mean? *2
    Would it be possible to use geometry alone to explore the result? Or just packing, or just ‘ballons’? This looks like enough fun to keep developing.
    I can look at this all day! I prefer the failing ones, though :)
    I love the simple design! I think your genetic structure explains what is going on very well. Your research on failing ones are very funny :)
    Wouldn’t the fitness function be, to minimize the acceleration (shock) on the egg when it hits the ground, while minimizing material costs? Ah, yes, that’s what you’ve done. YES, it is very challenging to come up with good fitness functions for genetic algorithms.
    I love eating eggs.
    I like the extensive experimentation with the idea. Great Idea Evaan!
    Love the blooper reel. Truly charming process documentation. Good reasearch. +1
    ** I agree
    It seems more interesting when there is something wrong with the code or somehing that you did not expect to happen. haha
    Great documentation, I’m glad you got it working in the end
    ** Great presentation as well.
    great concept; simple, relatable and would be interesting to find more real life paramaters to incorporate. nice work!
    Nice job recording all of your progress – it’s great to see all the different versions of the genetic algrithm, especially the ones with silly bugs. The only thing I wish I had seen more of is more variation in the type of egg-saving apparatus.

    Nice premise, good introduction. Funny (and good idea) for a simulation project. physics plus genetics in feedback!

    I love the visual simplicity. It is very compelling. Watching the video I find myelf rooting for the design or for chance to save the egg. I think it is interesting to see all the variations on the one balloon design but I would love to see other strategies.

    Good documentation and presentation. Love the blooper reel. +1

    A really fun way to apply a genetic algorithm; I like the simplicity of the graphics. +1
    Good documentation of the “unsuccessful” attempts.
    very cute, i’d like to see a group of kids play with it

    It is really impressive that you stuck to the mechanics of creating a proper genetics algorithm. With just an american iconic simulation I could easily imagine myself getting caught up in the visuals and making the simulation look believable.

    I would have liked to see some screenshots (in the blog post) of some final, “optimal” solutions.+1

    Did anything surprise you? Meaning, did you learn the best way of protecting an egg? Perhaps there were other variables you could have changed like box shape etc…

    Would’ve liked to see shapes other than rectangles. +1
    How does this sequece end? Can an “optimal” box from your algorithm outperform the 6 feet of bubble wrap?

    DId you find a solution that is successful while using the least amount of material? Once I did a eggdrop that had points for weight of the contraption as well- It was a good added challenge

    DROP ALL THE EGGS
    What is the optimal box? I agree that boxes can only be so interesting, it would have been more interesting to allow the system to construct the container some how, using joints and segments maybe.
    It would’ve been easy to draw a crappy little jpeg at each peanut / egg position, which could’ve been a good way to add some humor to the game. Bloopers rock

    I think the packing peanut coloring is the opposite of what I’d expect; I feel like darker circles are more dense.
    Good call on recording all the stuff that happened on the way. Many times I’ve wished I had a record of all the things that went wrong or were just cool during development.
    I also like the number of parameters in your system. It’s small enough to folow what going on, but there’s a large enough space to give some interesting solutions.
    What you just said about mutation rate is a good point. I hadn’t thought of varying the mutation rate between generations.

    I love that you are showing these bloopers! too funny+1

    I actually think your first stratedgy was really intriguing. I agree that your current one it seems too simple to converge on create the biggest balloon. What if you created the “box” out of the triangles that can surround the egg in various ways. I think
    I remeber the winning solution in our egg drops in school always involved creating a sort of landing platform out of straws.

    I think you should give toxiclibs a second shot …check this demo out for pseudo-collision detection: http://openprocessing.org/visuals/?visualID=22516 I think it would be much easier to vary the form of the container, as well as the packing material, and then you could go into 3D!

    Comment by admin — 29 March 2012 @ 6:43 am

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2024 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity