Skip to content

This is the repository of the paper The Electric Vehicle Travelling Salesman Problem on Digital Elevation Models for Traffic-Aware Urban Logistics

License

Notifications You must be signed in to change notification settings

pablo-csv/electricTSP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

electricTSP

This is the repository of the paper The Electric Vehicle Travelling Salesman Problem on Digital Elevation Models for Traffic-Aware Urban Logistics.

Authors: Yusef Ahsini, Pablo Díaz-Masa, Belén Inglés, Ana Rubio, Alba Martinez, Aina Magraner and Alberto Conejero.

Code

  • algorithm.py corresponds to an implementation of the algorithm developed in the paper to solve the EV-TSP for the city of Madrid. It takes as input a list of nodes from the graph of Madrid city madrid_elevation_energy.pckl and the output consists of an ordered list of all the nodes representing the solution to the TSP.
  • bellmanFord.py is a Python implementation of the Bellman-Ford algorithm.
  • evaluation.py is the scrip that offers the evaluation of the algorithm offered in Tables 1 and 2 in the paper.
  • neuralNetworkTraining.py is the scrip used to train and save the Neural Network model using the data generated by simulation.py .
  • nn_model_predictor.py is a script where the model trainined in neuralNetworkTraining.py can be used to generate predictions.
  • simulation.py is the scrip that simulated the routes trough the months of October and Novemeber 2022 using the data in snapshots_2022.zip. It generates the routes in simulationOctober.csv and simulationNovember.csv
  • twoOptNearestNeighnors.py is a Pyhton implementation of the 2-Opt algorithm that uses Nearest Neighbors to generate the initial tour.

Files

  • Madrid{5,10,15}.pkl are the test instances for the city of Madrid. Correspond to python list of list. Each list are a set of stops to visit in the city graph of Madrid (madrid_elevation_energy.pckl)
  • energy_estimation_full.h5 is a Keras model trained using nn_model_predictor.py to estimate the energy.
  • scaler_full.pkl is the scaler needed to use the energy_estimation_full.h5 model.
  • simulation{October, November}.pkl are the routes generated for each month using simulation.py.
  • snapshots_2022.zip are the traffic data for the months of October and November 2022

Web page

This web page allows the user to specify a starting point and then to add several stops. This returns the optimized route.

URL: https://smartrouteselection.streamlit.app

The main file is the main_web.py , which allows the web page to run.

The files needed to run this .py are: coords.csv, algorithm.py and elev_Madrid.json.

The libraries needed to execute the app are in requirements.txt.

The requirements.txt contains the specific versions of the libraries that allow the streamlit app to run the code without any compatibility problems. (May 2023)

The coords.csv is our own data base of the id and number coordinates of the different nodes, these are specific for the city of Madrid. It has been obtained by the elev_Madrid.json, which was used to modelize the city. In case we want to represent another city, the data format would have to present the same format. The explanation to obtain this json is specified above.

How it works:

Firstly, we need to obtain the number coordinate of the streets the user has entered. We have used the geocode API in this step.

Next, we obtained the nearest node in our data base, corresponding to the streets the user has entered and we make a list and a dictionary:

  • The list contains the id of de nodes
  • The dictionary has as keys "lat" and "lon" and the coordinates are added in the order the user has entered.

Then, the list is used in the algorithm, since the algorithm is built in order to recieve the id of the nodes and returns a list with the id of the nodes conforming the route and their coordinates.

Finally, with plotly we make the map graphic and we add the traces and specific points. One trace for the outgoing trip and other for the return trip, plus the points refering to the starting point and the stops.

About

This is the repository of the paper The Electric Vehicle Travelling Salesman Problem on Digital Elevation Models for Traffic-Aware Urban Logistics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%