# Minimum Inventory, Maximum Diversity

March 25, 2009 — Christopher Carlson , Senior User Interface Developer, User Interfaces

Q: What do proteins, snowflakes, and these figures have in common?

A: They’re all instances of “minimum inventory/maximum diversity” systems, a term coined by Peter Pearce in his book, *Structure in Nature Is a Strategy for Design* (MIT Press, 1978).

A minimum inventory/maximum diversity system is a kit of modular parts and rules of assembly that gives you maximal design bang for your design-component buck. It’s a system that achieves a wide variety of effects from a small variety of parts. Nature excels at this game: every one of the many millions of natural proteins is assembled from an inventory of just 20 amino acids. Snowflakes are all just arrangements of the humble water molecule, H_{2}O.

The same idea applies to the forms in the figure above, which are all constructed from semicircles joined at connection points evenly distributed along a vertical line. I stumbled onto this minimum inventory/maximum diversity system while playing with logo designs for a previous blog post, Exploring Logo Designs with *Mathematica*. The idea came from a logo for a concert hall by Peter Andermatt, approximated here:

In my previous post, I was exploring parametric variations of logo designs in *Mathematica*. Although this concert-hall logo is trivially easy to parameterize and get into *Mathematica*, I nearly didn’t try doing so because I didn’t think that the exploration would lead anywhere interesting. So much for my intuition. Relative to its simplicity, the idea of joining semicircles at fixed points along a line is one of the richest and most expressive component systems that I’ve run across. That becomes apparent once you build a widget to explore the concept.

Not wanting to invest much effort in something that I thought wouldn’t be productive, I dashed off a widget that hooked up sliders to the *y*-coordinate values of the endpoints of the semicircles:

This is what I saw as I began to twiddle the sliders:

Nothing astounding here, but at this early point two things became apparent: (1) there was more out there to explore than I had expected, and (2) it would be worth my while to invest effort in a better widget to explore it with. My quick-and-dirty widget had done its job: it pointed the way toward something more interesting. If it hadn’t been so easy to construct, I probably wouldn’t have made it, and I would have passed right by the elegantly simple system I’m about to describe. This is one of the strengths of *Mathematica*: you can do things on a whim that with other systems would require so much effort that they wouldn’t be worth your while. And so you miss opportunities to discover new things.

I designed a more usable widget (using the `Locator` function) that let me drag the semicircles directly and add and remove semicircles by command-clicking on a Mac (alt-clicking for Windows). I also gave myself more control over the details of how the forms are rendered. This took more thought than my initial attempt, particularly in understanding how to constrain the locators so that the endpoints of the semicircles land on the connection points. Nevertheless, I had the new exploration widget refined and running in about 20 minutes. I think it has an impressively high ratio of functionality to volume of code.

Now I was off and running through this space of designs, and discovering all sorts of intriguing forms. The more I explored, the more I wanted to explore:

I began to notice recurring themes—the idioms of this design language—such as spirals, wormy forms, and the comma-shaped *Fischblase* or *mouchette* found in Gothic window traceries:

To get a better overview of the material I had to work with, I decided to do some exhaustive generation of forms. For that, I needed a representation of forms and a function for rendering it. I settled on an `ArcForm` expression whose arguments are the list of *y*-coordinate values of the connection points, and lists of endpoint indices for the left and right arcs. Here is an example:

With this representation, writing a function that generates all of the forms with a given number of connection points is straightforward and concise. The function forms all pairs of connection points, then all subsets of the pairs, then all pairs of the subsets. Every possible arc form is contained in those combinations.

Now I could begin to see in a systematic way what’s out there. With two connection points, there are four possible forms (one of which, with 0 left arcs and 0 right arcs, is empty):

With three connection points, that number goes up to 64. This figure is the beginning of a useful catalog of the basic vocabulary of this design language:

From there the number of forms grows so quickly that after three connection points it is no longer practical to render them all. A back-of-the-envelope *Mathematica* calculation shows just how quickly. There are `Binomial[n,2]` possible two-element subsets of *n* objects—the number of different arcs available for each side of a form with *n* connection points. There are `2^Binomial[n,2]` ways of taking subsets of that set—the number of arc combinations available for each side. And the square of that number gives the total number of distinct forms, as each form combines one member of that set on the left side with one member on the right side. Thus the total number of forms with *n* connection points is

How quickly that number rises is graphically evident in this table:

With a modest eight connection points, a figure showing all possible forms drawn at the scale of the figure above would almost exactly cover North America. Imagine crisscrossing the continent from Panama to Alaska to Greenland on your hands and knees, nose to the ground, searching for forms! No, *really* try to imagine that! Think about how huge a task exploring a figure the size of a mere soccer field would be. Now think about crawling around your entire city. Extrapolate to your continent. Such is the magnitude of the search task, an immensity that you’re hardly aware of when such large numbers are hidden behind the buttons and sliders of an exploration widget. From here on out, this was the central problem I grappled with: how to grasp the possibilities within this ungraspably large space of designs.

Now my adventure became both exploration and meta-exploration. At the same time I was exploring the design space, I was exploring how best to explore the design space. *Mathematica*‘s trivially-easy-to-use interface constructs made it possible for me to try out and discard a number of widget possibilities before I arrived at a combination that worked well for the amount of effort I was willing to invest. I tried “scrubbing” through entire design spaces using sliders, random sampling of various sorts, and several methods of presenting samples. What I arrived at is a pair of widgets that work together: a “discovery” widget for sampling the design space, and a “design” widget for developing particular forms that I picked out of the design space.

This is the discovery widget (click for an enlarged view):

The discovery widget implements a “generate-and-test” paradigm: it randomly generates forms with a given number of connection points and left and right arcs, and selects those that meet given criteria. Each press of the “more” button gives a new sample, whose size I can control. By displaying many forms at once, I get an aerial view of the design space and can cover territory more quickly.

The selection criteria are implemented as filter functions that given an `ArcForm` return `True` (retain) or `False` (reject). Here is the filter for forms that contain at least one circle. It tests that there is some member of the left arcs that also occurs in the right arcs. Such a pair forms a circle.

I wrote additional filters for rotational symmetry, forms that are enclosed in an outer circle, forms with limited arc radii, and so on. I designed the filter portion of the widget so that I could easily drop in new filters as they occurred to me.

The last section of controls in the widget let me choose how the forms are rendered. Depending on what graphical phenomenon I’m interested in, I may want to see thick or thin lines, butt or round end caps, black-on-white or white-on-black.

With this widget, I sampled spaces of increasingly complex forms, pulling out some that I thought gave the illusion of design intention; that is, that appeared to show evidence of a human hand. This is what I found:

5 connection points, 1 left arc, 2 right arcs:

5 connection points, 2 left arcs, 2 right arcs:

6 connection points, 1 left arc, 2 right arcs:

6 connection points, 2 left arcs, 2 right arcs:

6 connection points, 3 left arcs, 2 right arcs:

8 connection points, 3 left arcs, 4 right arcs:

One of the more interesting filters is the one for rotational symmetry. Turning it on yields forms that remind me of traditional printer’s embellishments…

…as well as some non-traditional candidates.

Rotational symmetry also yields a practically inexhaustible supply of “S” logos. Most are unlikely to win a beauty contest, and they tend to have a forties or fifties design vibe. But each is interesting in its own right, and together they are a reminder of how very many variations there can be on a single theme.

Some of the generate-and-test filters are fantastically inefficient. A rotational-symmetry-with-maximum-arc-diameter-2 filter that I used while exploring the printer’s embellishments rejects upwards of 2000 forms for every one that it accepts. But who cares! It’s fantastically efficient for *me*. The scheme was easy to implement, and I was able to get down to the real work of exploring quickly. The typical laptop is capable of generating and testing half a million forms in the amount of time I’m willing to wait after clicking the “more” button.

The second component of my exploration tools—the “design” widget—pops up when you click one of the forms in the discovery widget. It provides a way of exploring a single form in detail. The design widget has the same rendering controls as the discovery widget, but also lets you drag arcs and connection points in order to fine-tune or improvise on forms. I also added a “negate” setting that renders the negative spaces between the arcs rather than the arcs themselves. The shapes of those forms had intrigued me while I was exploring the design space. Here’s a snapshot of the complete design widget:

Using the discovery and design widgets together is a little like beachcombing. You wander around the design space looking for interesting forms or something that sparks an idea. When you find one, you toss it into the design widget for tweaking or exploration of related forms. Here is a snapshot of some informal exploration I did. Each row of forms begins with a form picked from the discovery widget, and proceeds through an exploration in the design widget.

You can try out the discovery and design widgets yourself by downloading the Demonstrations Arc Form Discovery Widget and Arc Form Design Widget. You may discover, as I have, that in design, constraint is freedom. Picasso put it this way: “Forcing yourself to use restricted means is the sort of restraint that liberates invention. It obliges you to make a kind of progress that you can’t even imagine in advance.” I wholeheartedly agree.