From 6ca9aa6c946a8f93565fd4a7064fbf1316a43002 Mon Sep 17 00:00:00 2001 From: "niehues.mark@gmail.com" <niehues.mark@gmail.com> Date: Tue, 31 Mar 2020 13:17:56 +0200 Subject: [PATCH] minor --- evrouting/charge/routing.py | 2 +- evrouting/gasstation/routing.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/evrouting/charge/routing.py b/evrouting/charge/routing.py index c7133a5..d02ac3b 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 e55f2bf..c207050 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) } ) -- GitLab