Hello everyone!
A few years ago, I wrote a C++ program that solves the VRPTW (Vehicle Routing Problem with Time Windows) pretty well.
(For those who don’t know, the Vehicle Routing Problem with Time Windows (VRPTW) is a problem where a fleet of vehicles has to deliver to a number of customers. Each customer must be visited within a specific time window, every vehicle has a limited carrying capacity, and the goal is to find routes that satisfy all these constraints while minimizing the number of vehicles used and the total distance or travel time.)
The solver had been sitting around for a while, so I decided that I might as well build a frontend and backend around it to make it into a full-fledged project.
This is the first devlog I’m publishing and I’ve just finished making the backend API using Drogon, a C++ library for building high performance REST APIs.
I also integrated my old solver with the backend. Originally, the code only contained the core algorithm, but I needed it to support a wider range of user inputs. I added API parameters for things like vehicle capacity, depot location, and custom distance matrices, then passed those inputs directly to the solver which I changed to make use of these inputs.
The hardest part was to adding support for the backend API to also take in a CSV file for the distance matrix and use that instead of the default Euclidean distance calculation. I also added an option for calculating distances using the Haversine formula which is used to calculate distances on the Earth’s surface. Whenever the user gives latitude or longitude coordinates, I use this formula instead of the normal Euclidean distance formula.
For the frontend I used Leaflet and OpenStreetMap to plot all the data points on the real-world map.
You can check out the website here: https://magicroute.vercel.app. The frontend isn’t connected to the backend yet, so most of the solving part is just a placeholder.
I would love to hear your suggestions or ideas so if you have any feedback, please let me know.
That’s it for this devlog and I’m looking forward to posting more devlogs!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.