Skip to content
Snippets Groups Projects
Commit 199292b5 authored by markn92's avatar markn92
Browse files

wip exception

parent 5fa649d8
No related branches found
No related tags found
No related merge requests found
......@@ -195,6 +195,16 @@ def shortest_path(G: nx.Graph, charging_stations: Set[Node], s: Node, t: Node,
:param U: Capacity
:return:
"""
# Check if t is reachable from s
# Todo: Test!
_path = dijkstra(G, s, t, weight=CONSUMPTION_KEY)
_w = fold_path(G, _path, weight=CONSUMPTION_KEY)
if _w < initial_soc:
return {
'trip_time': fold_path(G, _path, weight=DISTANCE_KEY),
'path': [(s, 0), (t, 0)]
}
contracted_graph: nx.Graph = contract_graph(G, charging_stations, capacity)
extended_graph = state_graph(contracted_graph, capacity)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment