Algorithms to Live By: The Computer Science of Human Decisionsby Brian Christian, Tom Griffiths
A fascinating exploration of how insights from computer algorithms can be applied to our everyday lives, helping to solve common decision-making problems and illuminate the workings of the human mind.
“The theory of optimal stopping is concerned with the problem of choosing a time to take a given action.”
The paths of our lives are scattered with decisions that need to be made in short amounts of time. Some of us try to get a new house, find a partner or pick the perfect candidate for a job. These are just a few examples of the big decisions towards which we need to take the best actions. But even searching for the right parking spot can sometimes be challenging.
This is where the theory of “Optimal Stopping” comes to the rescue – making the right decision at the right time.
For example, when someone interviews 100 candidates for a job, the chance of finding the best match for the job is 37%. They should look at the first 37% of the applicants, choosing none, then leap for anyone better than all those they have seen so far. Similarly, if you are looking for a new apartment and you only have 30 days to make your decision, apply this solution. Dedicate 37% of your 30 days, which means 11 days, to searching for the perfect place to rent and be ready to make a decision on day 12. Choose the best apartment you have seen in the past 11 days.
As humans, there are lots of factors that get in the way of the quality of our decisions: time pressure, financial resources, impatience, and even boredom. People tend to stop early or get overwhelmed when they can’t make a decision after considering it for too long. Research has shown that many of us have a tendency to stop earlier than needed, at a rate of 31%. This is not far from the optimal 37%.
We need to think more rationally and find the perfect balance of decision-making in order to better our lives. This means not looking exhaustively at all our options and practicing patience in our search. After all, the most relevant aspect of decision-making is only one: learning when to stop.
Actions to take
Explore vs. Exploit
“Being sensitive to how much time you have left is exactly what the computer science of the explore/exploit dilemma suggests.”
Creating a life full of excitement and scattered with great decisions requires balance. Exploration and exploitation are both parts of our existence, but so is learning when to choose one or the other.
Simply said, exploration means gathering information, and exploitation means using it in order to get the best results for yourself. Finding the right balance between the two is the key to enjoying a life full of rewards and great experiences.
Explore as much as you can when time is on your side. Many concepts, such as the Gittins index or the Upper Confidence Bound, claim that it’s better for individuals to face lesser-known options as the satisfaction of finding pleasant surprises is one of the best feelings. Nevertheless, exploration can lead to experimenting with the unpleasant, as well.
Exploit the quality of your circumstances and your already-lived experiences. When people become “set in their ways,” they often prefer to explore their favorite restaurant, bookstore, or coffee shop rather than trying out new places. Fearing the disappointment of unpleasantness actually refrains them from living one of their best experiences.
A psychology professor at Stanford, Laura Carstensen, elaborated the idea of how people tend to choose between exploration and exploitation. She concluded that older people tend to get set in their ways because as they age, they begin to strategically reduce their social circles. However, age was not the primordial factor.
When older people were asked who they would rather spend 30 minutes with between a family member, the author of their favorite book, or a new acquaintance with whom they share the same interests, their answer was a family member. On the other hand, when younger individuals were asked the same question, they either picked the author or the new friend. You can see here a classic decision between exploitation or exploration.
But, when younger people were given a different scenario, moving to a different country soon, they changed their answer to a family member, as well. So what can we understand from Dr. Carstensen's study? The exploration and exploitation phase depends on the stage of life in which each one of us is set.
Actions to take
Sorting: Making Order
“Sometimes mess is more than just the easy choice. It’s the optimal choice.”
When it comes to being an organized person, everyone seems to have a different perspective on what makes one more productive than the other. Some say it is a bit excessive to have your books alphabetically ordered, while others view it as necessary. But who is right?
Keeping your space clean and organized is a great way to live for most people, but there are people who find organization a complete waste of time. The authors of this book claim that people who enjoy organized chaos might be just even more productive than people who enjoy tidy spaces. How? Because if you know where you can find everything you need in an unorganized space, the chances are you save the time spent on sorting things you never have to look out for.
There are three algorithms that can help you when it comes to efficiently organizing your space:
Bubble Sort - organizing each pair at a time.
For example, if you have a disorganized bookshelf, start with the letter A. Then, compare the first two books and sort them alphabetically. After that, compare the second book with the third one, and so on. This is the least efficient method.
Insertion Sort - this comes in handy when you have a lot of stuff to organize.
If you have the exact bookshelf, to apply this algorithm, take out all the books and then simply put them back in an alphabetical order one by one.
Merge Sort - divide everything into piles from A-Z and then merge the piles.
This method sounds a bit complicated, but it can also be the most efficient.
It all comes to whatever method you believe suits you best. However, there is a fine line between wasting time doing unnecessary things and actually being productive. All in all, sorting something you will never search for is a complete waste, and searching for something you never sorted is merely inefficient.
Actions to take
Caching: Forget About It
“Just as the tidiness of a scholar’s desk may hide the messiness of their mind, so does the apparent tidiness of a computer’s file system obscure the highly engineered chaos of how data is actually being stored underneath the nested-folder veneer.”
Forgetting is to human beings what caching is to computers. Sometimes, you just have to wipe some space to make room for new data. But the problem is: how do you know what to get rid of?
How many times have you thrown away something you later realized you actually still need? Apparently, computers can make our life easier by sharing with us three different methods by which we can organize our life:
Random Eviction - means getting rid of any stuff because the most important things (which you actually need) keep getting back in.
First In, First Out Rule (FIFO) - when you get rid of the things you have for the longest time and haven’t used it.
Least Recently Used (LRU) - getting rid of the thing that’s gone the longest untouched.
Let’s say you want to declutter your closet. You can apply these methods to get rid of unnecessary items you don’t need.
By applying the first method, you get rid of random stuff without thinking if you still need them or for how long you keep them. On the other hand, when you apply the second rule, you’ll have to get rid of the clothes you kept for the longest in your wardrobe – in this case, this might be the best method. Lastly, you can try the last method, which means you have to get rid of the particular items you haven’t worn in a long time.
Actions to take
Schedule: First Things First
“The moral here is that a love of getting things done isn’t enough to avoid scheduling pitfalls, and neither is a love of getting important things done.”
Sometimes the manner in which we achieve our tasks isn’t the primary concern, and we just want to get done as many things as possible and as quickly as possible. Turns out this method might not be the best method to finish your daily to-do list.
What is the best way to be as productive as possible and deliver the best work at the same time? You need to find the method which works best for you.
However, your usual strategies may not work efficiently when there’s a deadline involved. When we have many tasks with a due date, we tend to start from the closest deadline to the furthest. But, if your tasks are due at the same time, it’s better if you choose their order by how long they take.
Let’s say you start on Monday morning with two projects on your agenda: the first one takes four days, and the second one takes one day. Which one do you begin with? If you start with the four-day project and deliver it on Thursday and the other one you deliver on Friday, your clients will have waited for a total of nine days (the first client waited four days and the second client five). If you reverse the order, you finish one task on Monday and the other on Friday, then your clients will only wait six days in total.
This method leads to a very simple optimal algorithm called Shortest Processing Time: always do the quickest task you can.
Another good approach is to weigh how much the task will take you to get it done and then work in order from the highest resulting importance-per-unit-time to the lowest. Only prioritize a task that takes twice as long if it’s twice as important.
Actions to take
Bayes’s Rule: Predicting the Future
“Complexity is punished by the labor of speaking at greater length and the taxing of our listener’s attention span.”
Have you ever thought of ways to win the lottery? Or perhaps foresee if something is bound to happen again? Predicting the future seems like an impossible thing to do. But what if that’s not true? Algorithms might help you out.
In the eighteenth century, the Reverend Thomas Bayes came up with a quick solution to predicting the future using just one simple theorem: accurately being informed about the things you want to predict. He claimed that events can always be experienced at their proper frequencies. For example, if you want to win the lottery, consider the possibility of winning tickets in circulation. By doing so, it might be possible to guess the probability of your tickets’ results.
Later in 1969, J. Richard Got III came up with the Copernican Principle: you can predict how much time something will last if you think about the period of time it has lasted already. For example, when Got saw the Berlin Wall for the very first time, it had been up for eight years, so he predicted that the Berlin Wall would still be in its place for another eight years. But, this theorem cannot be realistically applied to everything, for example, someone’s life span. A 90-year-old cannot possibly live for another 90 years old.
Therefore, by applying both theorems, we can only come to one conclusion: you may be able to foresee a certain event only if you know as much accurate information as possible about it.
Actions to take
Over-fitting: When To Think Less
“In contrast to the widely held view that less processing reduces accuracy,” they write, “the study of heuristics shows that less information, computation, and time can in fact improve accuracy.”
When we need to make a decision, we often believe that the more reasons we have for our pros and cons list, the better. In fact, that’s wrong. The more we dive into overthinking a decision, the harder it is to make it. Oftentimes, there are only one or two reasons which weigh-in more than others when taking the initiative to make a move. Thus, overthinking makes us procrastinate.
When we complicate the scenarios, we need complex algorithms to completely unravel the best decision. Overfitting is a sign of being too sensitive to the actual information we’ve encountered. The solution is clear: we must balance our desire to find a good fit against the complexity of the decisions we need to make.
When Charles Darwin was trying to decide if it would be better or not to get engaged to his cousin, he made a pros and cons list. In the pros column, he wrote children, companionship, and “charms of music & female chit-chat.” In the cons column, he came up with anxiety provoked by children, visits from relatives, not enough freedom, and the possibility of his cousin’s maladjustment to the city of London.
So, is Darwin’s list equally reasonable in order to overthink his decision? You probably already guessed which right decision was obvious to make. And he did. He proposed a few months later. So why did it take so long for Darwin to make a decision? Because he thought too much.
We are able to make better decisions by deliberately thinking and doing less.
Actions to take
Relaxation: Let It Slide
“When computer scientists are up against a formidable challenge, their minds also turn to relaxation, as they pass around books like An Introduction to Relaxation Methods or Discrete Relaxation Techniques. But they don’t relax themselves; they relax the problem.”
How many times have you come across a problem which you had no clue how to solve? As social beings, the answer might be “many times.” In this case, computer algorithms might come in handy.
Let’s say you want to throw a party and you want to invite all the people you know. If you decide to send out invitations, it's more expensive than just sending out emails to a group of people asking them to invite other people they know. There are three methods you can apply to find a solution to any problem:
Constraint Relaxation: remove a constraint (or more constraints) from the problem and simplify the problem. So, instead of worrying about saving a few bucks buying stamps, send out invitations to everyone. If you send more invitations, you have a bigger probability of having more guests at your party.
Continuous Relaxation: as there’s no efficient strategy for this problem, you can try to understand the possibilities you have, continuously searching for the most optimal answer. In our case, relaxing it from discrete to continuous optimization means that a solution may be to send someone a quarter of an invitation and someone else two-thirds of one. What does that even mean? You could, for example, choose to simply round them as necessary, sending invitations to everyone who got “half an invitation” or more in the relaxed scenario.
Lagrangian Relaxation: using this method means separating the constraints into two groups: the easy constraints and the hard constraints. Then, all you have to do is simply eliminate the hard constraints. So, when we think about the downsides of our situation, we can create two groups of constraints. The first one includes spending more money to send all the invitations, and the second one implies spending time sending emails and invitations, while we can’t be sure that all of the people will receive the invitation and come to the party. The simple solution is to pay to have all the invitations sent by mail.
Actions to take
Randomness: When To Leave It to Chance
“There is no such thing as absolute certainty, but there is assurance sufficient for the purposes of human life.”
What exactly is “randomness”? Some think it means luck, others spontaneity, but when it comes to giving an exact definition, no one seems to know how to exactly apply it in their life. It seems like randomness appears in our life when we least expect it. That’s probably why people have never thought of ways to actually put it to use.
William James, assistant professor of psychology at Harvard and author of “Principles of Psychology,” wrote an article in the Atlantic Monthly called “Great Men, Great Thoughts, and the Environment.” James believed randomness to be the “heart of creativity.” So, how exactly can you stimulate the process of creativity?
Computer science comes up with three methods in which you can achieve this:
Hill Climbing - even if you’re in the habit of sometimes acting on bad ideas, you need to always act on good ones.
Metropolis Algorithm - your likelihood of following a bad idea should be inversely proportional to how bad an idea is.
Simulated Annealing - you should front-load randomness, rapidly cooling out of a totally random state, using ever less and less randomness as time goes on, lingering longest as you approach freezing. Temper yourself—literally.
Actions to take
Networking: How We Connect
“The world’s most difficult word to translate has been identified as “ilunga,” from the Tshiluba language spoken in south-eastern DR Congo.… Ilunga means “a person who is ready to forgive any abuse for the first time, to tolerate it a second time, but never a third time.”
Human interaction is the foundation of computer algorithms. Thus, while it might seem impossible sometimes to communicate one with the other, computer science can provide a clear perspective.
The root of human connection is protocol, which is a mutual convention of procedures and expectations, from handshakes, hugs, and hellos to etiquette, politesse, and the full circle of social norms. Protocol is how people get on the same page. The word is rooted in the Greek protokollon, “first glue,” which refers to the outer page attached to a book or manuscript.
Even so, how can we be sure we transmit the right message to another? Or be sure that they receive that message? Apparently, computer scientists have determined some methods:
Retransmit Until Breakdown - sending more than just one message, hoping one of them will get through and, therefore, we’ll receive an answer. This might not be the best solution.
Exponential Back Off - take a pause between messages. A simple example would be the following situation: you have a friend who often flakes on plans. Instead of giving him/her three chances and then giving up the relationship, you can simply reschedule in a week, then two, then four, then eight. The rate of “retransmission” goes toward zero, but you never have to completely give up on this person if you don’t want to.
Additive Increase and Multiplicative Decrease - understand someone’s limits. Before bombarding one with different types of interaction (emails, texts, phone calls), start with a text then if you get a response, you can text them more or even call them.
Actions to take
Game Theory: The Minds Of Others
“In poker, you never play your hand,” James Bond says in Casino Royale; “you play the man across from you.”
The principles of human behavior are connected to certain ideas brought to light by computer scientists. And while others don’t seem to think there are any tricks to adapting one’s “game,” apparently, there can be a lot to lose if you don’t pay attention to human instincts.
There are three ways in which you can see computer algorithms being used in human interactions:
Equilibrium - adapting your behavior as a response to your opponent. For example, when we play Rock-Paper-Scissors, there is only a ⅓ possibility to win. Once both players adopt this strategy, there is nothing better for either to do than stick with it. If you tried playing more rock, your opponent would quickly notice and start playing more paper, which would make you play more scissors, and so forth until we both settled into the ⅓ equilibrium.
Mechanism Design - or easily put: change the game. If the rules of the game force a bad strategy, maybe you shouldn’t try to change strategies. Maybe you should try to change the game. The Mechanism Design principle is finding the rules that will give us the behavior we want to see.
Information Cascades - paying attention to the behavior of others will offer you access to information that clarifies the world around you. Or simply said: mimic others’ behavior. But is this the most rational thing to do? Not always. Take as an example the 2007-2009 mortgage crisis after more and more people started investing in real estate. These are called “cascades.” When you’re mostly looking to others to set a course, they may well be looking right back at you to do the same. Cascades get caused in part when we misinterpret what others think based on what they do. So, be the one who sets the tone.