An introduction to fleet routing on Nextmv Cloud

March 25, 2021

At any given time on planet Earth, the following problem is unfolding: several vehicles need to visit multiple locations to pick up and/or drop off any number of things. This scenario applies to delivering food, transporting people, plowing snow off streets, transferring goods from distribution centers to retail outlets, moving milk from farms to processing facilities, and more.

These are all routing problems. Solving them in real time can be challenging, but it doesn’t have to be. We believe that finding good routes should be automated, seamless, fast, and even a bit fun. And we’d like to demonstrate this to you with a high-level overview of our vehicle routing experience on Nextmv Cloud. By the end of this post, you should feel empowered to click, run, and modify some basic elements in our cloud offering.

To follow along, you'll need a Nextmv Cloud account. Create one by visiting our website and clicking the “Get started” button. You can then sign into cloud.nextmv.io.

Input data and run

Logging into Nextmv Cloud will drop you straight into the fleet routing experience. You’ll see a section at the top of input data, results, and an empty map.

blog-vehicle-routing-problem-input-data-fleet-demo-nextmv-cloud

Let’s start with the Input Data section, which contains a JSON input file. At the top, you’ll see fields and values that identify the two vehicles in our fleet, their start and end geo coordinates (a TopGolf parking lot in Allen, Texas), and their capacity. If you keep scrolling, the JSON input changes to show fields and values that identify the 10 locations the vehicles need to visit, the geo coordinates for each, and a pickup quantity at each stop. (In this instance, “pickup” is denoted with a negative value that represents a reduction in vehicle capacity.)

If it helps, you can imagine that our two vehicles are sourcing TopGolf equipment like golf balls and clubs. Both vehicles have to visit 10 vendor locations in the outskirts of Dallas, Texas and return to their TopGolf home base. We want to find the most efficient way to route our two vehicles to these 10 locations. In this example, this means minimizing the distance (in meters) they need to travel.

With this in mind, let’s get right to the good stuff: click the teal “Run” button. Wait a few seconds and you’ll see two colorful routes appear on the map. Congratulations, you’ve successfully solved a fleet routing problem. Now, let’s have a closer look at what just happened.

Routes on a map

Your map has two colored polygons representing routes — one for each vehicle. You can isolate a given route by clicking on the vehicle switches that appeared in the Results tab. Go ahead and turn them on and off to watch the routes appear and disappear. Just below those switches, you’ll also see a few radio buttons where you can change the route display from approximate (straight lines between two points) to road (routes on top of paved streets).

blog-vehicle-routing-problem-model-run-results-and-map-nextmv-cloud

Output data basics

Now, let’s have a quick look at the Output Data section just below the input and map panes. This section of the console gives you details about all the magic that happened right after you clicked “Run.” As you scroll through it, you’ll see general information about the software version, import path, and model details. Once you reach line 37, pause. Here you can see the locations assigned to each vehicle in our small fleet and the order in which each vehicle visited those locations.

Beginning at line 83, you’ll see information about the solve statistics. For this post, we’re going to focus on solutions, time, and value. The values for each of these are 11, 1.42 seconds, and 59384. But what does this mean? This tells you that Nextmv found 11 feasible solutions (i.e., complete routes) in the 3 seconds it had to solve. It actually found the best solution in less time, in this case 1.42 seconds. The value represents the total distance traveled in meters, which is 59,384m or 59km (or about 36 miles).

To put this in context, let’s create a point of comparison. Scroll back up to your Input Data, locate the “Solver Options” button, click it to set the slider to 1 second, and click “Run.” Scroll back down to the statistics in the output data. Notice anything different?

blog-solver-statistics-nextmv-cloud-comparison-three-seconds-one-second

In one second, Nextmv found 7 feasible solutions. It found the best solution (with a value of 60km or 37 miles) in about half a second. If we’re just looking to minimize distance traveled, this is still a good solution!

There is more to explore in terms of determining how long to run a model to find operationally good solutions — but that’s a deep dive we’ll reserve for future blog post. For now, we want you to continue to explore the ins and outs of the fleet model on Nextmv Cloud.

Play, tinker, and explore

At this point, you’ve successfully solved two routing problems for a fleet of two vehicles — one where you provided Nextmv with 3 seconds to search for solutions and another where you provided it with 1 second to solve. There are several other ways to modify our model to reflect real-world variations of routing problems. Here are a few to get you started.

Change capacity for your vehicles

All of the JSON input files are editable. Try changing the capacities for each. What happens if Vehicle 1 has a capacity of 500? Or 100? See how the map changes and the output data changes. You can even change the pickup quantity at each location.

Change measure for your model

If you scrolled all the way to the bottom of the input data, you probably noticed a field called type:haversine. Haversine is a measure of angular distance between two points on a sphere, like Earth. This kind of distance is also often described as "as the crow flies." You can edit this field to be other types of measure, including: euclidean, taxicab, or constant. Simply replace haversine with any of those and see how the routes change.

Add a third vehicle to your fleet

Copy lines 3 through 14 in the input file. Paste them into line 15 and change the vehicle ID to something new. How does your map change? How does your output data change?

Run the other input files

As you’ve been customizing your input data, you may have noticed that the Select Input dropdown changed to "Custom." You can continue to customize this input file or change to a new one and customize it.

We provide a few other starting points for exploration. We began this walkthrough with a tiny fleet input consisting of 2 vehicles visiting 10 locations. As a next step, try scaling up your operations by running a base fleet input of 20 vehicles and 63 locations. (Get ready: it gets really colorful really fast.)

blog-nextmv-cloud-input-data-options-fleet-vehicle-routing-problem

It’s common for our customers to have specifications such as pickup and delivery precedence (e.g., a vehicle must visit location 4 before location 6) and time windows (e.g., a vehicle must visit a location within a given time frame). Run each of these and customize them as you go along.

You can even customize the file with geocoordinates of your choosing. We had a bit of fun around the holiday season with this.

You’ve reached the end of this beginning

What we covered in this post only scratches the surface of what Nextmv is capable of and what our customers are achieving with our products. If you’d like to learn more about how to customize a value function, account for compatibility attributes, and more, reach out to our team and we’d be happy to chat. Until then, keep playing, tinkering, and exploring with Nextmv!

Featured posts