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

minor fix

parent 962a1fa2
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,11 @@ def insert_start_node(s: Node,
graph_extended.add_node((s, initial_soc))
v: Node
for v in gas_stations:
shortest_p: List[Node] = nx.shortest_path(graph_core, s, v, weight=DISTANCE_KEY)
try:
shortest_p: List[Node] = nx.shortest_path(graph_core, s, v, weight=DISTANCE_KEY)
except nx.NetworkXNoPath:
continue
w = f.path_consumption(graph_core, shortest_p)
if w > initial_soc:
continue
......@@ -65,7 +69,11 @@ def insert_final_node(t: Node,
graph_extended.add_node((t, final_soc))
u: Node
for u in gas_stations:
shortest_p: List[Node] = nx.shortest_path(graph_core, t, u, weight=DISTANCE_KEY)
try:
shortest_p: List[Node] = nx.shortest_path(graph_core, t, u, weight=DISTANCE_KEY)
except nx.NetworkXNoPath:
continue
w = f.path_consumption(graph_core, shortest_p)
if w + final_soc > capacity:
continue
......
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