Algorithms to make you more effective

comments 2
Growth
Shakey the Robot.
Shakey the Robot. (Source: Computer History Museum)

Your focus and how to protect it

Earlier on in my career, I was under the impression that success was strongly tied to saying yes.

That quick favor? No problem. That interesting idea that someone just mentioned to me in the kitchen? I should probably prototype that. Jumping on that call to a client? Why not. 

Always saying yes is how I thought I could be most helpful and how I could open myself up to the most opportunity. I mean, there’s even a very funny book about it.

Well, unfortunately saying yes all of the time, even with good intention and kindness, is a path towards being extremely nice but ultimately ineffective. 
Being effective, on the other hand, involves two strands of management of the self:

  1. Being able to organize my time and my mind so that I have the best chance of being as productive as possible.
  2. Saying yes to the most impactful pieces of work and politely refusing those that are not.

We’ll get on to exploring the types of things that you should be spending your time on shortly, but first, let’s zoom in a little more into how you spend your time.

Taking inspiration from algorithms

You, just like everyone else at your company, and like everyone else in your industry, partners and competitors alike, have exactly the same amount of time in the day. What really matters is how best you use it. People who understand how they best function and subsequently arrange their day around their productivity traits can be dramatically more productive than those that do not. 

To get some inspiration, let’s look at computers: specifically CPUs.

Context switching

Your operating system is doing a great number of different things at once. 
All of the applications that you are running execute inside many running processes. Now, just out of curiosity, what’s my laptop doing right now? As I open up Activity Monitor on my MacBook Pro as I write this sentence, this is what it looks like:

Activity Monitor.
Processes running on my laptop at the time of writing.

As you can see from the bottom of the window, there are hundreds of different processes and thousands of active threads. However, my laptop only has 8 CPU cores on which these processes can be executed. All of these processes are able to operate on a handful of cores by a neat trick: context switching. 

In order to give us – the slow humans – the illusion that the computer is doing many things in parallel, all of these tasks rapidly switch between one another, executing the next bit of work, then switching to the next process, executing for a bit, then switching, and so on. This switching happens extremely quickly, often at the rate of hundreds or thousands of times per second. To us mere mammals, everything appears to be happening at once.

However, context switching is expensive

Instead of being able to execute instructions continuously in one process, all of this multitasking requires administration: stopping a process involves saving state and then loading in new state for the new process. The CPU isn’t doing anything useful while this context switching is happening. The less context switching that occurs, the more instructions that are executed on the CPU cores. 

Do you see where this is going?

The first step of protecting your focus is to realize that context switching frequently between your own tasks is involves expending effort on administration but not impactful output. The longer that you can spend working on one task continuously, the more effective that you will be in aggregate. 

Aside from being interrupted by someone, you can manage your own environment to ensure that you don’t context switch excessively:

  • Close all other windows and tabs while you’re working on something. Resist the temptation to peek at your notifications, or just disable them.
  • Block out periods of deep work in your calendar where you declare yourself uninterruptible. There is the concept of offline hours which we’ve tried at various times in the office.
  • Drive your focus away from reactive messaging. Batch process emails, DMs and chats at specified times of the day. Again, you’re just like a computer: batch processing is often more efficient than serial execution.
  • Don’t start on a new task until you’ve finished the one that you’re doing. Although having multiple tasks on the go gives the illusion of productivity through busywork, just remember that CPU loading and saving state again, and again, and again. Inefficient, inefficient, inefficient.

Some context switching isn’t bad. Often a manager’s job relies on context switching between many different issues. But limiting it increases throughput of individual tasks.

So we’ve looked at CPUs to direct out thinking about how to focus better on tasks you’re working on. But can computing teach us anything about saying no to work that isn’t impactful?

I think that it can.

Pruning search trees

Search is a classic computer science problem. I’m not talking about Internet search engines here, though – I’m thinking about pathfinding. Given two places on a map, how do you decide the best route from A to B?

Let’s get our imaginations working.

Pretend that you are in London, standing at Trafalgar Square. You need to get to Regent’s Park. 

You have absolutely no idea how to get there and you have nothing at your disposal to help you out: no map, no people to ask, and no phone. The only way that you can probe your way to Regent’s Park is to effectively guess by walking in random directions for an unbounded amount of time, and it doesn’t take a stretch of the imagination to predict that you’re going to be quite lost quite quickly. 

A map of London.
Where do I go? (Source: Google Maps)

That’s not going to work.

Now imagine this time that you are standing at Trafalgar Square looking at a map. This time you can see the destination on the map, and you put your finger on it. That’s your first heuristic: the straight line measurement between your current location and the destination. 

But which way should you go? There are sixty thousand roads within the six square miles of central London, so plotting out the shortest route ahead of time is a massive, complex search space. Iterating through all of the possibilities will leave you standing here for weeks. 

Instead, you decide to use your heuristic: you walk down the first road that’s roughly in the straight-line direction of your destination, walk to the next junction, and then look at the best direction to go based on your new orientation towards your destination. You repeat this process, and eventually you get there.

Neat! This is something that we’ve been making computers do for over 60 years. 

The A* search algorithm works in a similar way. It is a best-first search that intends to optimize the route taken from point A to point B to be the one with the lowest cost calculated via a heuristic, preventing the need to exhaustively explore each potential path ahead of time. 

In the London route finding scenario above, the smallest cost is the least amount of walking required between the starting point and the destination. Typically the A* search algorithm performs this “walk” over a graph data structure.

A weighted graph.
A weighed graph. (Source: wikimedia.org)

Routes between places (A-E in the diagram) are represented as weighted edges on a graph, where the weights (the numbers in the diagram) represent the distance between those places. At each step of the algorithm, like in the scenario walking through London above, the algorithm expands the next possible steps and applies a heuristic – typically adding together the weights – to pick the one that costs the least. 

Repeated application of this heuristic ensures a speedy arrival at the destination.

An animation of A* search.
A* search in action. Note how the path is found without needing to explore the whole search space. (Source: imgur.com)

But how does this algorithm apply to the way that you manage your focus? I believe there are two themes which are related:

  • You can define a heuristic to prove that what you are working on is the most impactful task at any given time.
  • Then you can apply your heuristic to guide your choice of work, dramatically pruning your mental search space by focussing on the most important thing. You can say no to everything else with good reason.

Defining your own heuristic

I can’t predict what the most important thing that you should be working on right now. What is it? 

At a very high level, as a manager, I typically follow the formula that Andy Grove stated in High Output Management:

A manager’s output = the output of their organization + the output of the neighboring organizations under their influence. 

This formula allows me to prioritize the numerous things I could be working on each day, especially on days where I have free time and the luxury to choose activities. Instead of getting overwhelmed, I can prune my own search space accordingly by making sure that what I am doing is making an impact to the largest possible amount of people.

For example, if you have an important product launch coming up, then de-risking that launch as soon as possible may be your primary heuristic. If it’s growing your organization after receiving funding, then it’s that. If you’re an individual contributor working on the architecture of your application, then your heuristic could be continually improving the speed to serve data, or designing a plan to scale that architecture over the coming years. 

Optimize towards taking the shortest path to achieving that goal at all times. Yes, you can be A* search!

Shakey the Robot.
Shakey the Robot: invented by the researchers that also invented A* search. Yes, this is you now. (Source: Wikipedia).

The best part about defining your own heuristic for choosing the work that you should be doing is that you have a bulletproof reason for how you are prioritizing your time. 

Refusing that meeting where your attendance is not completely necessary, or opting out of other periphery work is no longer a matter of letting anyone down personally: your reasons are justifiable because you are laser focussed on a goal that will be maximally impactful for the company.

So what can you do?

Think about how to create the best conditions for you to work. Prevent those context switches as much as you can. Then be smart about what you are working on throughout the week: what is your heuristic that guides you towards your goal? Prune everything else away.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *