Skip to content

This is a Python-based algorithm that optimizes the collection of product packaging by grouping locations based on pin-codes. It calculates the shortest distance or duration routes for collecting packaging, reducing e-commerce wastage effectively.

License

Notifications You must be signed in to change notification settings

jithendra-varma/Shortest_pickup_path_algorithm_using_python

Repository files navigation

Cost Efficient Product Wastage Collection from Customers of E-Commerce.

In this technological era due to increase in the use of mobile phones and internet, e-commerce had a huge boom. So along with this increase in e-commerce, the wastage produce along with it is also increasing in the form of plastic wrappings, bubble wraps etc. These types of wastes are called e-commerce wastage. This e-commerce wastage can be decreased if a company can make a way to reuse the product wrappings in a cost-efficient way.

So, we are proposing an algorithm that can provide a cost-efficient way to collect the product packaging’s back from the customer. This algorithm collects the location of the customer when the customer taps his mobile on the NFC enabled packaging. Then we process the locations of the all the customers who used this feature. Then we monitor the density of people who are willing to return the packaging back at different locations.

We group these locations based on pin-codes which act as a natural way to group locations. Such that if the density of orders at a certain pin-code reaches the threshold. A product recovery agent is sent to the location. He follows the path generated by our algorithm which is obtained by careful calculation of cost, distance, duration of all the path combinations. Such that making the collection of product packaging an efficient one.

The algorithm that is used in this process is explained here in the file Pickup_path_plotter.py.


Let us imagine that we are a startup pickup company. We will have a set of pickup destinations, made known to us prior to the day of pickup, So as to plan a route that starts from our pickup depot, goes to each destination and ends back at the same pickup depot. This route will be optimised to either be of shortest distance or shortest time duration required. We also only have one pickup van. As such, we are only looking at a basic TSP and not the Vehicle Routing Problem.

NOTE

What makes this algorithm unique is that it groups locations based on the pincodes and works only when certain no of orders at a certain pincode location crosses the threshold.

Packages to Install for this project

  1. ortools

       You can install it with the command pip install ortools

  1. gmplot

       You can install it with the command pip install gmplot

  1. urllib

       You can install it with the command pip install urllib3

Create an API_KEY for google maps

Steps to remember when creating the API_KEY:

  1. Open google cloud console.
  2. Enable billing by providing billing information.
  3. Create a new project
  4. Enable the folloing four apis.
    • Geocoding API
    • Distance Matrix API
    • Maps JavaScript API
    • Directions API
  5. Get the API_key credentials

These APIs are free for 90 days after the billing is enabled for your account.

Inputs to the code

This program takes four inputs 3 in terminal and 1 in the code.

  1. Enter the file contaning address as csv file with extension(.csv).
  2. Enter the depot location.
  3. Enter the min no of orders per pincode.
  4. Enter the API_Key in the __main__ function.

Example Inputs:

Enter the file name of the csv file with extension .csv : list.csv
Enter the pickup depot location : tirupati
Enter the min_orders : 10

Outputs to the code

The are two types of outputs for this project.

Termianl Output HTML files Output

These outputs contains two types of data one being calcualated using shortest distance and the other using shortest duartion.

Terminal Output

  1. Shortest Distance Path
Route based on shortest distance:
 tirupati -> Narasingapuram 517102 -> Chandragiri Fort 517102 -> Bopparajupalle 517102 -> Dornakambala 517102 -> 
 Buchinaidupalle 517102 -> Mungilipattu 517102 -> Kotala 517102 -> Rangampet 517102 -> Seshapuram 517102 -> Bhimavaram 517102 -> 
 Kalyani Dam 517102 -> Sree Vidynaikethan Eng College 517102 -> Kmm institute of technology 517102 -> Mangapuram 517102 -> tirupati
Route distance: 111.775km
Route duration: 3:41:45
  1. Shortest Duration Path
 tirupati -> Kmm institute of technology 517102 -> Sree Vidynaikethan Eng College 517102 -> Seshapuram 517102 -> 
 Bhimavaram 517102 -> Rangampet 517102 -> Kalyani Dam 517102 -> Narasingapuram 517102 -> Bopparajupalle 517102 -> Dornakambala 517102 -> 
 Buchinaidupalle 517102 -> Mungilipattu 517102 -> Kotala 517102 -> Chandragiri Fort 517102 -> Mangapuram 517102 -> tirupati
Route distance: 114.844km
Route duration: 3:34:15

HTML files Output

  1. Shortest Distance Path

This returns a HTML file Pickup(distance)map.html

Shortest Distance

  1. Shortest Duration Path

This returns a HTML file Pickup(duration)map.html

Shortest Duration

License

This project is licensed under the MIT License.

Contact

For any inquiries or feedback, please contact:

About

This is a Python-based algorithm that optimizes the collection of product packaging by grouping locations based on pin-codes. It calculates the shortest distance or duration routes for collecting packaging, reducing e-commerce wastage effectively.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published