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 Dispatch app for fleet vehicle routing 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.
Let’s start with the input data. The input file we’ll explore here is called Tiny Fleet. At the top of the file, you’ll see fields and values that identify default settings for the vehicles in our fleet. This includes:
- Vehicle start and end geo coordinates (a TopGolf parking lot in Allen, Texas)
- Shift start and shift end
- Speed (in meters per second)
If you keep scrolling, you’ll see an itemized list of each vehicle in our fleet (currently just two) and the 10 stops the vehicles need to make. Each vehicle has a defined capacity. Each stop has a defined pickup quantity that will update the vehicle capacity after each visit. (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 demo, this means minimizing the total time both vehicles are on the road (in seconds).
With this in mind, let’s get right to the good stuff: click the teal “Run App” 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 routes, one for each vehicle. You can isolate a given route by clicking on the vehicle switches that appeared in the Results. Go ahead and turn them on and off to watch the routes appear and disappear.
Within the map interface, you’ll see options that allows you to toggle between approximate road routes to straight-line routes using Haversine distance.
Output JSON basics
Now, let’s have a quick look at the Output JSON. This section of the console gives you details about all the goodness that happened right after you clicked “Run App.”
As you scroll through the output, you’ll see items that let you see the software version, the options configured around the solve, and the improving solutions returned within your runtime.
Let’s have a closer look at the third item in that list: solutions. Here you can see information about the three solutions found, including the stops assigned to each vehicle, the value of the solution for that vehicle, travel distance (in meters), travel time (in seconds), and the order in which each vehicle visited each stop.
If you move down to statistics and expand search, you can see at the bottom that one solution was found. Under time, you’ll see that single and best solution was found in roughly 500 microseconds.
In more complex scenarios, you’ll typically see many feasible solutions get returned. This number often varies depending on your runtime as well. There is more to explore in terms of 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 Dispatch app.
Play, tinker, and explore
There are several other ways to modify our app 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.
Add a third vehicle to your fleet
Copy lines 22 through 25 in the input file. Paste them into line 26, add in a comma after the curly bracket in line 27, 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 15 vehicles and 63 locations. (Get ready: it gets really colorful really fast.)
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. Check out this post for an Oktoberfest routing adventure.
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!
Editor’s Note (October 19, 2021): This post was updated to reflect updates to the input and output schemas in Nextmv Cloud.