Hi, this is Jarvis

May 5, 2020 • 5 minutes

What do we understand by an algorithm?

An algorithm is a set of defined, non-ambiguous instructions or rules that, applied systemically to appropriate entry data, solve problems automatically in a finite number of pre-set steps.

At Glovo, the algorithm used to assign orders to couriers is called Jarvis.

Why is it called Jarvis?

Jarvis is an artificial intelligence robot that helps the main character in the film Iron Man. It’s extremely intelligent and always gives good advice. When we developed the first version of this algorithm, it was given this name because it fitted well with what it was going to do: help the agents that were previously manually assigning orders to couriers.

What exactly does the Glovo algorithm do?

Jarvis is a process carried out every few seconds that looks at all the new orders in the city, all the available couriers and calculates the optimum courier-order assignment.

Why are algorithms used by companies? What value do they add?

The use of the algorithm mainly allows for processes to be automised and made more efficient.   If you imagine a switchboard situation, this would be the process it would follow for a similar activity to Glovo’s: receive a call with a client order, identify the business where the product will be picked up, identify the courier who’s closest to both the business and the end client, call the business to let them know about the order, call the courier to let them know the pickup point, call the user to confirm their order and track the order in case of any problems.

Technology allows the Glovo algorithm to take charge of this whole process, and do it efficiently because it calculates which courier will have the shortest journey between point A and point B objectively and immediately. That means that journeys are more efficient and there can be more order per hour, less waiting time, etc.

What factors does the algorithm take into account to make its decision?

Jarvis itself doesn’t make any decisions, it only follows the previously established parameters. The factors that it takes into account to solve the “problem” are:

  • Food or merchandise preparation time
  • Courier vehicle
  • Traffic
  • Seasonality/demand
  • Exceptional situations (adverse weather conditions, protests, areas closed off due to danger, etc), so that couriers’ routes are more efficient and they earn more for every order they deliver, and so that they’re safer.

What are the areas of knowledge that the algorithm is based on?

The algorithm is mainly based on two areas of knowledge.

  • Artificial Intelligence. To predict time and demand, the algorithm uses statistical prediction models, which include machine learning models.
  • Operations Research. This consists of mathematical problem-solving and decision-making methods, which are necessary to solve the order-courier assignment problem without the need for help.

The scientific community is currently very interested in both areas, and we always try and stay up to date with new discoveries to see if they could help with the algorithm’s performance.

What prediction times does the algorithm work with?

The algorithm is operating 24 hours a day for all the cities that Glovo operates in. In each city, the algorithm runs every few seconds, noting the orders and couriers that are available at that moment.

How does this algorithm affect the 3 pillars of Glovo: courier, user, business?

This algorithm is vital for the satisfaction of the 3 pillars of Glovo, because it directly impacts every one of them.

From the point of view of the courier, a good assignment algorithm allows them to deliver more orders per hour, and so increase their income. The algorithm means they avoid having to follow inefficient routes (very long, a lot of waiting, etc). It also considers dangerous areas of the city, protests or inclement weather.

For the user, the algorithm has a decisive influence on the total delivery time, which is one of the biggest factors in satisfaction. It helps avoid their order spending too long at the store or restaurant, makes sure the courier’s route is direct, etc.

For businesses, the algorithm should mean that they avoid having a backlog of prepared orders nor waiting couriers. A mistake with the algorithm might mean that prepared orders end up waiting for a courier coming to pick them up. They get cold, and often that the restaurant has to prepare them again, whilst also leading to a poor user experience.

Does it determine the slots a courier can choose?

No, the algorithm doesn’t play any role in couriers’ collaboration slots. Roughly one week in advance, all couriers have the chance to choose their slots on the calendar: this is the point when they can decide how many slots they want or hope to do.

Does the algorithm determine how much the couriers earn?

Jarvis, as an algorithm, isn’t able to determine anything. It needs the input of a human being. The structure of couriers’ earnings is determined by the operations team. It works like a taxi: there’s a base rate, to which is added an amount for every km covered, and for waiting time. Jarvis simply calculates things based on each journey.

How does Jarvis choose a certain courier? Is it predetermined?

Jarvis establishes the optimum courier based on the distance between the pickup point, the delivery point and their current location. Its main aim is for this journey to be as efficient as possible (short, calculated times). If the courier rejects the order, the procedure starts all over again.