Evolved design
September 26, 2013 4:20 PM   Subscribe

Unleashing Genetic Algorithms on the iOS 7 Icon - In the pursuit of something just a bit tighter than Marc Edwards' superellipse approximation, Mike Swanson applies genetic algorithms to the task of making a better button-making script.
posted by Blazecock Pileon (19 comments total) 9 users marked this as a favorite

 
That's pretty neat!

Genetic algorithms are in use all over the place, in part because they're not that hard to write. The Postgres database system actually does genetic optimization to plan queries. One of the Mars spacecraft used a genetically-optimized antenna shape. But I kind of love that this guy is putting so much effort into something that is basically trivial and no one will ever notice.
posted by miyabo at 5:45 PM on September 26, 2013


It's not clear to me if the author is using a genetic algorithm or if he is using genetic programming. The difference would be if he was using a genetic algorithm, he would be refining the parameters used by his script. OTOH, if he was actually evolving the script itself, it would be genetic programming.

Regardless, it is not that surprising that the result was not perfect - evolutionary algorithms often create very good solutions rather then the "best" solution - and the same could be said for natural evolution.

If he wants to find a perfect solution, he might try a hybrid algorithm using simulated annealing or another hill-climbing algorithm after the GA has got within the near neighborhood.
posted by BillW at 6:01 PM on September 26, 2013 [2 favorites]


My mind was blown when I learned from someone who worked on genetic algorithms that you can encode the paramters of the algorithm in the genome and let those evolve alongside the solutions. So for instance, you might have a subpopulation evolving a higher mutation rate for a while, but this could become less beneficial in later epochs, leading to genomes that evolve differently.
posted by spbmp at 7:35 PM on September 26, 2013 [1 favorite]


The iOS7 system goes on-line September 18th, 2013. Human decisions are removed from strategic design. Photoshop begins to learn at a geometric rate. It becomes self-aware at 2:14 a.m. Eastern time, September 26th. In a panic, they try to pull the plug.
posted by charlie don't surf at 8:09 PM on September 26, 2013 [7 favorites]


BillW: "It's not clear to me if the author is using a genetic algorithm or if he is using genetic programming. The difference would be if he was using a genetic algorithm, he would be refining the parameters used by his script. OTOH, if he was actually evolving the script itself, it would be genetic programming. "

Given that the dude is trying to get something done, and we have a pretty good model for this kind of thing, I'm pretty sure it's a genetic algorithm evolving parameters to a Bezeir curve.
posted by pwnguin at 8:31 PM on September 26, 2013 [1 favorite]


It looks to me like the old icon was a square with circular arcs rounding the corners, while the new one uses cubic beziers. The difference is that, where the straight sides used to meet the arcs, there was a sudden change of curvature. Circular arcs have positive curvature, while straight lines have zero curvature. That's called a G2 discontinuity, and your eyes can sense it. With beziers, you can get the curved part to gradually go from positive curvature down to zero curvature, and it's less jarring.

Imagine driving along the boundary. On the curve, you turn the steering wheel and hold it steady, and go on a circle. Then at the join, you suddenly set the steering wheel straight, and hold it, going straight. You would notice that sudden jerk of the steering wheel, and you can see it visually looking at the path.
posted by Zpt2718 at 9:37 PM on September 26, 2013 [3 favorites]


According to the angels, it's pinheads all the way down.
posted by flabdablet at 2:31 AM on September 27, 2013


Genetic algorithms are in use all over the place, in part because they're not that hard to write.

I am not sure of that. The genetic part isn't hard, but the system which is mutated by the genetic algorithm to produce useable output, that is difficult to design, especially if you want to minimize any biases caused by the system. Like, a genetic algorithm that adjusts the parameters on Bezier curves, sure, but then you've excluded the whole field of sharp-cornered edges from you output. I think (I am no expert) that it is actually hard to come up with a system like that.
posted by JHarris at 2:58 AM on September 27, 2013


That's called a G2 discontinuity, and your eyes can sense it.

I've never heard of this, and searching for "G2" or "G2 discontinuity" doesn't yield anything immediately comprehensible. Would you mind explaining a little more? I know there are specialized cells in our visual cortex that can detect discontinuities in slope, but I've never heard a sourced claim that we had anything similar for curvature.
posted by Jpfed at 3:18 AM on September 27, 2013


The iOS7 system goes on-line September 18th, 2013. Human decisions are removed from strategic design. Photoshop begins to learn at a geometric rate. It becomes self-aware at 2:14 a.m. Eastern time, September 26th. In a panic, they try to pull the plug.

10:33 p.m. Eastern Time, September 27th. Photoshop erases humans from the Earth using content-aware fill.
posted by rory at 4:55 AM on September 27, 2013 [4 favorites]


Jpfed: It's second-order geometric discontinuity. wikipedia talks about it.

It has to do with the mathematical definition of "smooth". I once read that auto bodies have to be G^2 continuous, because they are shiny. If a surface is not G^1 continuous (ie, it has a kink), then things reflected on it will seem to have a break. If it is not G^2 continuous, then reflected objects will have kinks in them. Generally, reflected objects have one less degree of continuity than the mirroring surface that reflects them. I thought that was cool.
posted by Zpt2718 at 5:01 AM on September 27, 2013


I suppose this is as good a time as any to come clean about the cat pictures. They started because cute cat calendars and things like that were perennial sellers. Getting enough photogenic cats to do things in appealing and photogenic ways is pretty expensive, though... and you still have to have Photoshop jockeys retouching the results, which is also pretty expensive; you can brush smooth a supermodel's face but cats are supposed to look fuzzy...

So anyway, we figured if we built a GA that would create new cute photos of cats out of our inventory of cat photos, we could churn these things out ad infinitum without having to pay a photographer. Things went wrong in the same way kind of how they do in real life -- the cat would be sitting inside a box for some reason. Or their face looked grumpy or whatever. We would laugh at 'em but throw the pictures out of the data pool because they weren't cute, until one of our distributors saw 'em during a tour of the office. He was laughing his head off, saying the cat looked totally moronic, and on the spot offered us a place on the shelves in the "Novelty" section if we could get him a calendar in two weeks.

Sounded great but we were deleting those images to keep them out of the GA. One all-hands email later, and it turns out various members of the staff had for years been keeping their favorite rejects. We waived our usual policy about instant termination for rules violation, gave staffers a bonus for each saved pic, met deadline, and had our biggest seller yet.

For the past couple years we've been working in video and animated GIFs. Remember what I said about the box thing? We don't even have a cat-in-box optimized GA, it just happens. You hope for a nice picture of a fluffy cat sitting on a pillow on a handsome couch, and every so often you get a sequence of a cat sliding sideways across a countertop, or knocking over glasses of water, or unraveling toilet paper. There's the occasional short video of a cute fluffy cat digging into the jugular vein of a little blonde schoolgirl, but that doesn't happen often enough to worry about; we budget a group health policy here with pretty good mental health coverage for the staff.

It's pretty hot stuff, and the internet has given us a public with an insatiable appetite for it. We've got some business plans in the works that I can't talk about because of the mandatory quiet period imposed by the SEC, but I think you'll be happy with some of our coming products.
posted by ardgedee at 5:17 AM on September 27, 2013 [6 favorites]


It's second-order geometric discontinuity. wikipedia talks about it.

Thanks for the link!

I once read that auto bodies have to be G^2 continuous, because they are shiny. If a surface is not G^1 continuous (ie, it has a kink), then things reflected on it will seem to have a break. If it is not G^2 continuous, then reflected objects will have kinks in them.Generally, reflected objects have one less degree of continuity than the mirroring surface that reflects them. I thought that was cool.

Yes, but that has to do with reflecting surfaces. I don't think the old icons set off the same kind of visual machinery just by virtue of their silhouette having a curve with a G^2 discontinuity.
posted by Jpfed at 5:36 AM on September 27, 2013


I love Metafilter. This is a great post.
posted by nevercalm at 6:47 AM on September 27, 2013


I don't think the old icons set off the same kind of visual machinery just by virtue of their silhouette having a curve with a G^2 discontinuity.

That whole thing about the smoothness of reflective surfaces was kind of a tangent, but I had to throw it in, it was so cool.

For me, the non-G^2 points on the icon's silhouette still bother me. My visual system perceives the discontinuity, but I have to think mathematically about why it's happening to complete the perceptual act. It's kind of like feeling out of sorts, then realizing there is something sharp caught in your sock that is causing the feeling.
posted by Zpt2718 at 8:37 AM on September 27, 2013


What's the worst is seeing icons that have interior borders but haven't been updated for iOS 7's new icon outline shape, and it just looks soooo baaaad
posted by DoctorFedora at 8:49 AM on September 27, 2013


10:33 p.m. Eastern Time, September 27th. Photoshop erases humans from the Earth using content-aware fill.

Photoshop Creative Cloud has nondestructive editing. There's a networked Undo command center at Crystal Peak. Go there.
posted by charlie don't surf at 12:00 PM on September 27, 2013


It's pretty hot stuff, and the internet has given us a public with an insatiable appetite for it. We've got some business plans in the works that I can't talk about because of the mandatory quiet period imposed by the SEC, but I think you'll be happy with some of our coming products.


I have occasional Douglas Adams-y worries that Earth/The Universe is either a genetic algorithm for lulz and/or degrading horror, depending on my mood.
posted by Jon Mitchell at 9:31 PM on September 27, 2013 [1 favorite]


"The Universe is a joke by the general, at the expense of the specific."
-Aleister Crowley
posted by charlie don't surf at 5:22 PM on September 28, 2013


« Older A WAY TOO SCARY GAME   |   "A bit of distance between the... Newer »


This thread has been archived and is closed to new comments