Photo by Daniele Levis Pelusi on Unsplash

with Carolyn Mooney.

Making decisions is one of the primary human activities we engage in. The ability to assess situations, project possible outcomes, and evaluate and choose from sets of alternative courses of action is so basic to our lives that it often comes as second nature. Ignoring perhaps the most capricious among us, nearly every action we take is preceded by some form of that process.

On the other hand, the inability to make decisions can be quite debilitating. We prize and promote leaders who make good decisions quickly with limited information in our businesses and civic organizations. Indecision leads to a lack of progress and an inability to take action, which can end up being a decision of its own.

Yet indecision is a natural response to complexity. Stories abound of people who experience choice overload when faced with simple tasks such as choosing a brand of dish soap at a big box store. Spending too much time considering outcomes instead of acting leads to analysis paralysis. These aren’t just great band names, they are common human failures to understand the context in which decisions must be made, and to apply appropriate decision making strategies to our lives.

Their first album was better.

Consider throwing a dinner party for a few of your friends (no really, you should!). This dinner party begins with a series of decisions. You figure out a guest list. Maybe enough of your friends know each other and are comfortable together in a small group that this is easy. Or perhaps you have friends who don’t know each other and should spend more time chatting. You find a time that works for everyone, schedule delivery from your favorite restaurant, and whip up a few fun beverages. Your guests arrive 30 minutes after the appointed hour and have a lovely time!

Conflicting constraints and innate complexity can make even a simple dinner party appear unmanageable. What if our friends are feuding or, worse, have incompatible dietary restrictions? Some of them may only like beer while others drink wine, making it hard to figure out a main course. Busy schedules complicate timing, and are we sure we aren’t overburdening our guests by making them schedule a babysitter?

Now consider what happens when we change the party from hosting a few friends to a large gathering of hundreds of people. Imagine planning a wedding! Our response to this explosion of complexity is instructive. Do we spend time obsessing over details, or do we allow the scale of the larger problem to simplify some aspects of our decision making?

If we are successful at planning and executing large endeavors, we probably employ a number of decision making tools. For instance, we use a mapping system to plan out our stops for wine and cocktail ingredients. We ask our sommelier cousin for menu and beverage pairings. We have the main course prepared and delivered. If our guest list is long, we simplify the service by switching to buffet style and providing a small set of meal options that satisfy everyone’s base dietary requirements (would you like beef, chicken, or pasta?). We manage complexity by strategically ignoring certain parts of it and narrowing our focus to the most salient aspects of our problem.

At Grubhub we make a lot of decisions. For every order we deliver, we evaluate the state of the world (How busy are we? Do we have enough couriers? Is traffic bad?) and quickly communicate our best expectations to our restaurants and diners. That ravenously hungry diner decides on the best looking dinner that will arrive in the shortest available time frame. At this point, we don’t have a courier assigned to deliver their order, but we still have to estimate a delivery time frame that is short enough to whet the appetite and conservative enough that we can meet it! Once the diner orders, we coordinate handoff times between the courier and restaurant, again with very little hard information.

To make decisions about these time schedules and estimates, we continually examine our regions, evaluating an absurd number of potential routes, to decide the best courier and delivery pairings. Routing and assignment involve applying complex optimization models to an ever-changing landscape of information. Once an order is offered to and accepted by a courier, we continually re-estimate pickup and delivery times, and decide when new orders should be picked up to ensure maximum freshness. To keep delivery regions running smoothly, we recruit additional couriers in real time if we are undersupplied, project order volume weeks in advance, figure out the best mix of scheduled courier blocks, and so on and so on. For us, it’s like planning a massive wedding every minute of every day.

At this scale, it’s a practical requirement that we encode our decision making strategies into software (decision) services. During dinner rush, there are far too many orders to deliver and potential couriers for humanoid processing to be fruitful. The urgency of our decisions also motivates automation (no one likes hangry, we understand).

Further complicating matters is the issue that different decisions have different contexts. Context encapsulates the most important attributes of a decision, such as what sort of information it has access to, at what cadence, and how urgent it is. A courier schedule model may be executed a week before an operational period and not have strict requirements on runtime, while a routing and dispatch planner may need to execute within a minute and have access to real-time data.

Decision making technology has a similar trajectory to data processing and data science. These fields were born from necessity in wartime applications, during which computing brought complex manual processes into the automated world. The shift from batch processing of data sets to real time data transactions over networks motivated the development of new techniques and paradigms in software engineering.

So how does all of this help us get shawarma delivered to our soiree? The techniques we use to automate and understand the impacts of our decisions aren’t new. In fact, many of them, such as mathematical optimization, simulation, and stochastic processes, commenced development in the 1940s through 60s, and have spawned active research communities. What is new here is the scale at which we make decisions, the automation and integrations we use to build them into software services, and the methodology we apply in building and engineering them.

What do we do about the complex web of decisions in our real-time logistics network? The foundational concept is that we treat decisions as engineered components, the same as data or software. Our decisions are first-class citizens. We design, build, and set expectations for decisions the same way do for other systems, with a few additional requirements:

Decisions are repeatable. Given the same input, a decision model yields the same, or similar, output.

Decisions have defined contracts. These specify their decision data (inputs) and decisions (outputs). This allows us to isolate them from their service harnesses and study them independently. It simplifies integration into decision services.

Decisions are testable. Isolating them from their encompassing services allows us to unit test them the same way we do other software components. Complex interactions between multiple decision models can be tested in a similar fashion to integration testing of software services.

Decisions have precision that reflects the accuracy of their inputs. We don’t produce highly precise estimates of future states if we aren’t confident about our current state or the results of our potential actions.

Decisions have defined urgency. Knowing how much time a service has to make a decision constrains the type of model selected to make that decision.

Obviously, these are only some of the primary principles we live by in Decision Engineering. In future posts, we’ll dive into how we built out some of our automated decisions services at Grubhub and how those principles translate into action. Maybe we’ll even help you with your wedding plans. Or at the very least, we can provide you with a delicious meal at a minimum of fuss.