diff --git a/evrouting/T.py b/evrouting/T.py index 6c1920124ab3a96943155abd109478b02cfbeb7e..a72149b7a1db4576c9924da58726c55be577cc3b 100644 --- a/evrouting/T.py +++ b/evrouting/T.py @@ -1,4 +1,3 @@ -from dataclasses import dataclass from typing import Tuple, Union, NewType, Dict, Any Node = int diff --git a/evrouting/charge/T.py b/evrouting/charge/T.py index 2e813cbd25c61b16e09bb6e39044493d4ccf732b..82f4c5a00afe9e5349a27a21614a237f5d4ac80b 100644 --- a/evrouting/charge/T.py +++ b/evrouting/charge/T.py @@ -126,7 +126,7 @@ class ChargingFunction: if soc > capacity: # Return max charge time return capacity / c - elif soc < 0: + if soc < 0: # Return min charge time return 0 diff --git a/evrouting/charge/factories.py b/evrouting/charge/factories.py index 31a4ead463e081102ba7d16e855d9802d1186268..7131324368c07cf457e3791b10716d9a1cc55a04 100644 --- a/evrouting/charge/factories.py +++ b/evrouting/charge/factories.py @@ -2,9 +2,9 @@ from typing import Dict import networkx as nx -from .T import SoCProfile, SoCFunction, ChargingFunction, Label -from ..T import Node, SoC, Time -from ..graph_tools import charging_cofficient, consumption +from evrouting.T import Node, SoC +from evrouting.graph_tools import charging_cofficient, consumption +from evrouting.charge.T import SoCProfile, SoCFunction, ChargingFunction, Label class SoCProfileFactory: diff --git a/evrouting/charge/routing.py b/evrouting/charge/routing.py index 247bb1adf798ad7a0ce21a8faf8bf4daaab79666..713b63737b2fd62e13e0de55617869aa31b2e2cb 100644 --- a/evrouting/charge/routing.py +++ b/evrouting/charge/routing.py @@ -4,16 +4,15 @@ from math import inf import networkx as nx from evrouting.T import Node, SoC from evrouting.utils import PriorityQueue +from evrouting.graph_tools import distance +from evrouting.charge.T import SoCFunction, Label +from evrouting.charge.utils import LabelPriorityQueue, keys from evrouting.charge.factories import ( ChargingFunctionMap, SoCFunctionFactory, SoCProfileFactory ) -from ..graph_tools import distance -from .T import SoCFunction, Label -from .utils import LabelPriorityQueue, keys - def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node, initial_soc: SoC, final_soc: SoC, capacity: SoC): diff --git a/evrouting/charge/utils.py b/evrouting/charge/utils.py index 19e405dac8f40c88880f03486fcf419d3ebac3fc..072eade97e553a9f44b074613158c5d08e0b451c 100644 --- a/evrouting/charge/utils.py +++ b/evrouting/charge/utils.py @@ -1,11 +1,9 @@ from typing import Any, Dict, List -from math import inf from evrouting.utils import PriorityQueue from evrouting.T import SoC, Time - -from .T import Label, SoCFunction -from .factories import SoCFunctionFactory +from evrouting.charge.T import Label, SoCFunction +from evrouting.charge.factories import SoCFunctionFactory class LabelPriorityQueue(PriorityQueue): diff --git a/evrouting/utils.py b/evrouting/utils.py index 46baaa9f1df42043b2bb6e71b43c66d56eced8b2..b9127d3f51bcc553ce6bd98142515d79b0e1c074 100644 --- a/evrouting/utils.py +++ b/evrouting/utils.py @@ -45,8 +45,7 @@ class PriorityQueue: item = self.pq[0][-1] if item is not self.REMOVED: return item - else: - heappop(self.pq) + heappop(self.pq) raise KeyError('Empty queue.') def __bool__(self) -> bool: diff --git a/tests/config.py b/tests/config.py index 51f4617ee1827b3304797d796a64ac5552fad5ac..b8a730c9038a55ba7263b6c3a19c4b4647d10425 100644 --- a/tests/config.py +++ b/tests/config.py @@ -1,5 +1,4 @@ import networkx as nx -from copy import copy from typing import Set from evrouting.T import Node, ChargingCoefficient