You're so vain, you probably think this algorithm's about you.

 Photo by Curtis Perry

Tick, Click, Tick, Click, Tick, Click, Tick...

So I'm currently turning out onto a road in Portland trying to find this great Korean restaurant I heard about.

I love Portland, but in terms of navigation Portland is my kryponite. I always seem to go the wrong way. So to find this restaurant I do something that is completely common these days. Before I start driving I ask my handheld supercomputer (bonus phone included!) to navigate me to the restaurant. Even with all the other computer technology surrounding us this still always makes me wonder in awe at this world we have created. We truly live in the future.

My amazement is not because I don't know how it works, I do. It's also not because of the incredible complexity of cellular networks, satellites, road databases, human ground truthing of directions and more that make this possible. I mean that's all amazing but...


The really mind blowing thing is to realize that I am part of the algorithm/computer at this point.
Right now, I am part of a computation on a remote server.
You probably are too.

The world I am driving through is represented in a data structure on a server somewhere in California, or Oregon actually. My own behaviour is being controlled, or rather coaxed, by an instance of an algorithm running on that server. There are computer servers devoted, at this very moment, to routing me from my current location to the destination that I've specified. The internet is built upon computers routing messages back and forth to other computers, but how often do we stop to think that many times we are the ones being routed?

Computationally what is happening the server is focussed on moving me around in it's internal datastructures. From that computer's point of view, the goal is to move the id that represents my phone from one area in computer memory to another area in computer memory. That id moves around in the computer's datastructure representing the physical space of Oregon and it's roads. It has well understood constraints on how fast it can move and it is generally expected it will stay on roads. But unfortunately for the algorithm,  the actual behaviour of that id controlled by an external force, a mystery that can only be coaxed, never controlled directly. That mysterious force is me and the conditions that surrounds me on the road. The algorithm's goal is to coax me to behave in such a way that my phone id ends up in the target location within the computer's memory.


And I oblige as much as I can.

Who's in Charge Here?

When you send an email on the internet or ask your browser to show you a webpage you're just sending the same kind of information. "get me here", you say. Then various routes and plans are drawn up and sent off ahead to the servers to help your message arrive at it's destination. In this case, the message itself isn't doing the driving. The best way to explain it is that the message, your request to see, sets off on a journey, many towns away. It passes from town to town, carrying a piece of paper with it's final destination on it and it asks the mayor of each town how to get to the next one so that it will reach its destination. The message has no choice and doesn't actually even know the plan ahead of time, the network knows.

So, I have a little more control than that webpage request, I have to do the driving and try to satisfy the directions.

The point is when you see the world computationally you are always seeing the algorithms and system architectures that could explain the world, not just the computers in the world. Computers themselves are just a superficial detail.  It's the idea that whatever it is you do in your life, from navigating a difficult city or acquiring restaurant suggestions from your friends or doing your job there are algorithms you follow, there's data that you use. There are best practices for all those things, some of which we come up with in our head over time or get as advice from other people.
Those are all algorithms.

Having a machine run these algorithms for us is something we're used to.
Phones magically find the person we are contacting, planes get us from one place to another, calculators do arithmetic for us. But ubiquitously available GPS navigation is different. It's an instance of an algorithm telling us how to behave.

And we just do it, because it's easier.
I think it's a great thing, it saves us lots of time (to dictate blog entries for example).
But it's funny, that algorithm, on that server in California or Oregon or wherever it is, it directed me onto a route that was different than the original one I chose...


I made some wrong turn early-on due to Portland's unforgiving design of one way streets and short notice for exits...


When the algorithm on my phone recalculated the route it chose the most optimal route (ie. the shortest) rather than the suboptimal route I chose because I wanted to see a different part of town. No matter, I will get to my destination, because this algorithm is laser focussed on getting me to my destination, not showing me the scenic route. So how much am I in charge now?

The Value of a Choice

This raises another thought, what if we could tell the navigation everything we wanted and valued, what would we tell it? And how would we tell it? The navigational overlord didn't care about the scenic route I'd planned was because it was in its value model.

You've probably seen many GPS navigation apps have an option to 'avoid tolls' or 'avoid highways'. These allow the user to provide alternate value models that alter what is important when the algorithm is finding the optimal route. So your' saying:
'Get me to this destination, consider all possible routes and pick the shortest one that satisfies this constraint to avoid tolls or highways'. 
But you could easily implement other value models that say:
'...and while you're at it, try to pick a route along majors roads in Portland that I've never visited' 
'...if it doesn't add more than half an hour to my total time, pick roads where more people have posted scenic pictures on twitter from alongside the road.'
So don't get angry at your GPS when it reroutes you the 'wrong' way, it doesn't know any better unless you find a way to tell it. Well, that, and it doesn't care anyways, it's a GPS algorithm.


Hey, I made it.

Tick, Click, Tick, Click, Tick, Click, Tick, Click


I hope the restaurant is still open. Mmmm....Kalbi.

♫♪ You're so vain, you probably think this algorithm's about you... Don't you? ♩♫