adrianaris / routeOptimizer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ROUTE OPTIMIZER

This is a basic fullstack MERN web app. It offers the user the possibility to plan and optimize a list of addresses for deliveries (or whatever).


First of all I would like to thank Angel for his initial contribution. While I was trying to put almost all the logic on the backend he was quicker than me in finding a solution for optimizing 12 addresses, through api calls directly from the frontend, and I setled with that for the basic functionality.


The idea for this app came to me while I had a job to deliver 350 addresses in 3-4 days allover Belgium. Since the list of addresses was completely random and because it was so big I could not have it reordered manually in a decent amount of time.


    Technoligies used on top of MERN:
  1. REDUX, REDUX-persist, Redux-thunk, styled-components, TurfJS, bcrypt, jsonwebtoken, mongoose etc.
  2. Mapbox map api
  3. Mapbox geocoder api
  4. Mapbox matrix api
  5. Geoapify batch geocoder api
  6. Google OR-Tools


At the core this app solves the Traveling Salesman Problem. Since this web app has a presentational purpose I did not venture to offer a solution for Vehicle Routing Problem but I can morph it into that should I decide to.

It uses the Mapbox api to render the Map and to geocode, on the frontend.

In the backend it uses the Mapbox distance matrix api and Apify batch geocoding api. Since the matrix api has a limit of 25x25 (25 coordinates with property destination and source at once, per call) I had to split this call into smaller chuncks (12 destinations + 12 sources) and reconstruct the matrix myself in order to be able to optimize more addresses.

The apify batch geocoding api has the purpose of giving me the possibility to geocode an entire list of addresses (like from a file) and feed the result to the Mapbox matrix api.

After having the distance matrix I employ a python google ortools script that returns an ordered array of indexes with which I reorder (optimize) the list of addresses.

    From a functionality stand-point it can do this:
  1. Without a registered account it can optimize up to 10 addresses + the DEPOT.
  2. With a registered account it can optimize hundreds of addresses, save the user's previous routes on the backend, offer the possibility to change the navigator from waze to googlemaps, reuse older routes.

With or without an account the app persists its state between refreshes. Should the user close the browser or refresh the page, all the progress is saved.

About

License:MIT License


Languages

Language:JavaScript 99.6%Language:HTML 0.3%Language:Shell 0.0%Language:Nix 0.0%Language:CSS 0.0%