Once booked, your Kyte will be delivered directly to your doorstep by one of our “surfers” (= Kyte delivery driving partners) saving you the hassle of the traditional rental car pickup, waiting in line and getting frustrated by filling out a ton of paperwork. In this article we want to shed some light on one of the most central challenges that our engineering team is solving for: Automatically finding the best surfer to deliver your car exactly where and when you need it.
This article is the first one as part of a series of engineering-focused posts that are giving some background on what’s happening under the hood at Kyte, what engineering culture is like at Kyte and what other exciting problems we are tackling.
There are plenty of reasons why having a good automated matching algorithm is beneficial for both our customers and surfers:
Let’s take a closer look at the structure and constraints of the mathematical problem that lies behind finding the best surfer for a Kyte trip. In its most basic form (disregarding spatial constraints and assuming a fixed delivery and return time) the problem can be seen as a classical interval scheduling problem. The only hard constraint would in this case be that a surfer can only do one trip at a time. The figure below shows an example setting where the green three trips need to be fulfilled by any of the three surfers.
This interval scheduling problem can be translated into a graph coloring problem. Where each trip or unavailability is a node in the graph and we draw edges between all the nodes that overlap on the time axis. Each color corresponds to a surfer. Finding a schedule that works is then equivalent to finding a graph coloring so that neighboring nodes never have the same color. While there are many efficient algorithms for coloring a completely uncolored graph, it is in general a very hard (NP-hard) problem to finish coloring a graph with pre-colored. Since surfers are not available all day we will always find pre-colored nodes in our graph (see the “Unavailable” nodes in the Figure below).
On top of that, the graph representation can only contain temporal hard-constraints while in reality the time needed for a delivery or return highly depends on the surfers current location. This is why we need a further analysis of all the potential solutions we can find to the graph-coloring problem. And here is where heuristics for non-convex optimization problems come into play.
In the case of the situation in the figure below we ultimately have two different options for the return trips, it could either be done by Surfer 2 or Surfer 3.
Which out of these options is the better one depends on multiple factors that we have not considered in our temporal hard constraints so far:
To distinguish the best option we designed a cost function that takes the aforementioned parameters into account. Unfortunately, this cost function does not fulfill the criteria for a convex function. This means that if we want to find the optimal match between trip and surfer given all of these criteria there is no algorithm that can guarantee to deliver the global optimum solution in finite time.
Fortunately, we do not need to have this guarantee but it is sufficient for us to find a sufficiently good (close to optimal) solution. There are multiple heuristics that find such a sufficiently good solution efficiently. In the next section we will talk a bit more about which of these heuristics we decided to use and how it concretely works.
We are using a popular heuristic for non-convex optimization problems.
In general it is based on two core principles:
While we are already using the first version of the matching algorithm in our day-to-day operations we don’t stop here. We have ambitious goals to add a plethora of features and make our algorithm even smarter. Let us give you a quick look into some things we are currently working on:
As you can see we have lots of exciting projects on our agenda! If you are somebody that loves to work on real-world hard engineering challenges that combine the physical and digital world in a fast-paced environment, we would love to get in touch with you! Please don’t hesitate to shoot us a message at careers@drivekyte.com and we can give you some more insights on what we are working on!