Mental Models204 cards · 12 fields

Mental Models/Computing & Information

Combinatorial Explosion

指数爆炸

Each new choice multiplies the options, and soon there are too many to count.

In May 1997, in New York, Garry Kasparov sat across from IBM's Deep Blue and lost the six-game match 2.5 to 3.5. Deep Blue could evaluate about 200 million positions a second, and it still couldn't look at them all. In chess, every move you make gives your opponent many possible replies, and each reply leads to new choices of its own. Look a few more moves ahead and the number of positions grows thousands of times over. So the engineers never hoped to look at everything. Instead, as Deep Blue calculated, it cut off the branches that were clearly not worth calculating further.

You can see combinatorial explosion with a luggage lock. A four-digit code has 10,000 possibilities. Trying them from 0000 to 9999 at one a second takes nearly three hours. Add one more digit and there are 100,000, which takes more than a day: every extra digit splits each existing combination into ten more. Every extra digit multiplies the time by ten, so doubling your computing power only buys you 0.3 of a digit. Search programs, test checklists and staff rotas all run into the same thing.

Each extra digit means ten times as many to try
Combinations10k
At one a second2.8 hours
0500010k01234DigitsCombinations to tryCombinations
0500010k01234DigitsCombinations to tryCombinations

A 4-digit lock: 10,000 codes, nearly 3 hours at one a second. Drag to 5 digits: 100,000, over a day. Even 2 choices give 1,024 in 10 steps.

Each extra step multiplies the candidates once more

If each step has choices and every combination is allowed, steps give candidates. First let grow. With only two choices per step, on or off, ten switches give 1,024 settings, twenty give more than a million, and thirty more than a billion. Now let grow. With three choices per step, ten steps give 59,049.

No machine is ever fast enough to catch up

Sixty switches have about settings. Checking a billion a second still takes more than thirty years. A machine 1,024 times faster only handles ten more switches, because every extra switch doubles the number of settings.

Cutting whole batches works better than checking faster

In a ten-step problem with three choices per step, if you can rule out one option at each step before you start, the candidates drop from 59,049 to 1,024, less than 2% of the original. If a path goes over budget halfway through the search, every way of continuing it is thrown out at once, and not one of them needs checking.

However many candidates there are, they are only a burden when each one has to be checked. When the items' scores simply add up and don't affect each other, picking the best of each item gives the best overall. A common mistake is to cry explosion whenever a few factors come together. In fact factors have only pairs between them, which grows as a square, far slower than . When you need to prove a plan is the best, cutting branches by rule of thumb won't do: the best answer may be in one of the branches you cut.

Predict
Estimate how many complete models a product can come in: multiply the numbers of options for color, size and accessories, then see whether the warehouse and test line can cope.
Design
When designing a hiring process, put hard requirements like degrees, certificates and start dates first, so each one cuts out a batch of résumés before anything else. Then interviewers have time to look closely at the people left.
Act
When you face a list of options that must be chosen in combination, first work out the total number of candidates, then decide whether to check them all or set conditions to cut a batch first.
  1. Does this need the items judged in combination, or can each be picked on its own?
  2. If I add one more option or one more step, what does the total number of candidates get multiplied by?
  3. Is there a hard requirement that could rule out a whole batch of options before I look closely?

Logistics

Delivery order

Around 2013, UPS began rolling out ORION, its route-optimizing system. Ten addresses can be visited in 3,628,800 different orders, and once delivery time windows are added, nobody can compare them one by one. ORION uses heuristic search: it first rules out routes that clearly go the long way around, and gives the driver a route that is short enough.

Security

One more character

Suppose an attacker can make a billion guesses a second and your password uses only lowercase letters. Eight letters give about 200 billion combinations, which can be guessed in a few minutes; twelve give about , which takes about three years.

Personal life

Matching a renovation

You and your partner keep three choices each for eight items, including the floor, wall paint and kitchen cabinets. That leaves 6,561 combinations to compare at home. At one minute each, that's more than a hundred hours. So you first cross out the combinations that break your total budget or don't fit the space, then settle the few items you're already happy with, and only compare what's left one by one.

Combinatorial ExplosionDivide and ConquerSplit a big problem into smaller copies of itself, solve each, then put them back together.Thirty switches that affect one another, checked together, give a billion settings. If divide and conquer can split them into two groups that don't affect each other, checking fifteen switches in each takes just over 30,000 settings, and the two together come to less than 70,000. If it can be split, split it first; if it can't, you have to rely on cutting branches.Combinatorial ExplosionExplore vs ExploitThe more chances you have left, the more it pays to try something new.You're choosing where to open a store, with forty candidate shopping districts, and three of your stores are already doing well. Combinatorial explosion tells you not to check every district, but to set conditions and narrow the field first. Explore and exploit tells you not to stop at those three, and to keep a small part of the budget for trying districts you haven't touched. One tells you to close in, the other to leave a gap open. Narrow the field first, and once that's done, set aside a budget for trial and error among the districts that are left.Combinatorial ExplosionAdaptation and Local OptimaIf you only ever step uphill, you get stuck on the nearest small hill.When a full search is too costly, a common fallback is to start from the plan you have, change one thing at a time, and accept only changes that make it better. It's fast, but it can get stuck on a local optimum, like a small hilltop, and a different starting point gives a different result. If you need the very best, find ways to prune; if good enough will do, climb from several different starting points.

A lab is testing a thermostat with 14 settings, each with two choices. Every configuration has to be tested once, at one minute each. Now 3 more settings of the same kind are added, and the staff grows to 8 times its old size, working in parallel with no repeated tests.

What happens to the time it takes to test every configuration?

A club has 9 events it can either hold or skip. What each event would bring in has already been listed: some are positive, some negative, and they simply add up. The events don't compete for venues and there's no budget limit. The goal is the highest total.

Which approach is easy and also guarantees the highest total?

A process has 5 steps, and each step can be done in 4 ways. The total time is the days for each step added up, and every step takes a positive number of days. The ways chosen for neighboring steps have to fit together, so not every combination works. A program has already found one complete plan taking 30 days in total, and is searching for others step by step, aiming for the shortest time.

The program reaches a set of ways for the first three steps that already adds up to 31 days. What should it do next to save time and still be sure of the best?