diff --git a/evrouting/charge/routing.py b/evrouting/charge/routing.py index c7133a59622c801545bc8921e066606370200d79..d02ac3b7f9a3d7e9cfb449b3efe8695f984ba985 100644 --- a/evrouting/charge/routing.py +++ b/evrouting/charge/routing.py @@ -7,7 +7,7 @@ Implementation of the CHArge algorithm [0] with two further constraints: [0] https://dl.acm.org/doi/10.1145/2820783.2820826 """ -from typing import Dict, List, Tuple, Set, Union +from typing import Dict, List, Tuple, Set from math import inf import networkx as nx diff --git a/evrouting/gasstation/routing.py b/evrouting/gasstation/routing.py index e55f2bf394513952f16d904389b08944e240a3a9..c207050f64dc36f7579442e0ba9bc1f3b7ca8e57 100644 --- a/evrouting/gasstation/routing.py +++ b/evrouting/gasstation/routing.py @@ -1,4 +1,4 @@ -from typing import Set, List, Tuple +from typing import Set, List import networkx as nx from evrouting.T import Node, SoC, Result, EmptyResult, Time @@ -106,12 +106,12 @@ def contract_graph(G: nx.Graph, charging_stations: Set[Node], capacity: SoC, # Iterate unvisited charging stations for n_cs in [n for n in charging_stations if (n, cs) not in H.edges and n != cs]: min_path: List[Node] = dist(G, cs, n_cs) - consumption: SoC = fold_path(G, min_path, weight=CONSUMPTION_KEY) - if consumption <= capacity: + w_cs_n: SoC = fold_path(G, min_path, weight=CONSUMPTION_KEY) + if w_cs_n <= capacity: H.add_edge( cs, n_cs, **{ - CONSUMPTION_KEY: consumption, + CONSUMPTION_KEY: w_cs_n, DISTANCE_KEY: fold_path(G, min_path, weight=DISTANCE_KEY) } )