Electric vehicle routing engine
A limited implementation of road network routing for electric vehicles.
Electric vehicle routing is unique from standard road routing because there is a much smaller range that a vehicle can travel due to battery limitations. Furthermore the limited number of charging stations and the variability in the charging rates at those stations means that an optimal route must consider the state of the battery after traversing different arcs and routing decisions must include how much time to spend charging at each station.
This program finds a single-source-single-destination shortest path minimizing total time of travel, considering both driving time and amount of time spent charging at each station where each station has a different charging rate. The network graph used is restricted to just charging stations so routing results ignore real road network ways.
To build run:
make
The binary can be executed by providing two location names from the network.cpp
file:
./routing_engine <origin station> <destination station>
The output is in the format:
<origin station>, <station_1>, <hrs spent charging at station_1>, ..., <destination station>
To build and execute a bash script which compares routing results to a reference implementation run:
make test
A python helper script can be used to examine the reference implementation results for benchmarking (requires python3):
make bench
I created an algorithmic approach based around a variant of Dijkstra’s algorithm by using the observation that this problem resembles several similar path routing problems such as constrained shortest path and bicriteria shortest path.
Briefly, the idea is this:
First create the overall graph which can be reused between searches:
To Perform a search, do a standard Dijkstra’s except:
A key simplifying point is that although battery state is continuous and therefore there are theoretically infinite possible labels, in this model we need only consider doing one of three actions when arriving at a charging station:
The overall algorithmic approach and the code are my own, but some inspiration was drawn from:
“Shortest Feasible Paths with Charging Stops for Battery Electric Vehicles”, Baum et al. 2019
Full text: https://arxiv.org/pdf/1910.09812.pdf
But that paper deals with a much more complicated NP-hard variant of this problem, due to their consideration of: