Posts

Create a route optimization algorithm with zero costs using google's OR-tools and OSRM Part 1

Image
This is a tutorial for an algorithm that has riped over the years of experience in doing algorithms and websites  for carpooling, Uber like service, Freight routing, and many other applications. I will be stating the current algorithm and i will discuss my decisions on certain code implementations as well as some of the previous decisions that i took and proved to be wrong, slow or error prone. This algorithm is capable of optimizing for thousands of locations, and made to be highly customizable. Features of the algorithm are: Reading data from and exporting data to an excel sheet or a Database. Multiple time windows per location. Multiple vehicle types, capacities, buffers, depots. Custom optimization parameters like distance, time, fuel consumption, etc. Pickup and dropoff. Custom loading and unloading time per stop. Custom service time at certain locations. Custom max idle time waiting for the next stop's time window. Custom distributed workload amongst ...

Create , insert, read, modify, drop data from POSTGRESQL db using python

I have supplied here, some of the code that i used to interact with a db for a carpooling service. So after creating the DB and the algorithm, i wanted to test my algorithm against live fuzzy data, so i created some functions that removed data from the DB, added new random data while respecting some rules. Here we explore the rules that i saw fit for the website. def create_tables():            statements = [['DROP TABLE recommendations'],                                  ['DROP TABLE offer CASCADE'],                                  ['DROP TABLE request CASCADE'],                                  ['DROP TABLE event CASCADE'],                   ...

Host your own version of a map for free

This is a tutorial on how to use OSRM to host a local version of your map so as to query it as opposed to querying the readily available services on the internet like google maps, mapbox, routific, etc.  Each has its own weaknesses and strengths, the strength points of OSRM are speed, freedom to manipulate the map data and zero costs. First we need to download the map data, The bigger the area, the more time it will take to extract the map data and the more RAM it will occupy when hosted, and this thing is hungry for RِAM. We can extract and host it on a server which we will discuss later, We can download the compressed daily updated map data which can be found on  https://download.geofabrik.de/   , download the osm.pbf file which is a compressed file, you can also click on any of the regions, like Europe or wherever you want, to get a sub region and download it. Or you can also use  https://extract.bbbike.org/    , which can be a bit ...