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

little refactor

parent eb7f67b3
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ from math import inf ...@@ -4,7 +4,7 @@ from math import inf
import networkx as nx import networkx as nx
from evrouting.T import Node, SoC, Time from evrouting.T import Node, SoC, Time
from evrouting.utils import PriorityQueue from evrouting.utils import PriorityQueue
from evrouting.charge import factories as factories from evrouting.charge.factories import soc_profile as soc_profile_factory
from ..graph_tools import distance from ..graph_tools import distance
from .T import SoCFunction, Label from .T import SoCFunction, Label
...@@ -42,7 +42,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node, ...@@ -42,7 +42,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
t_trip=0, t_trip=0,
soc_last_cs=initial_soc, soc_last_cs=initial_soc,
last_cs=dummy_node, last_cs=dummy_node,
soc_profile_cs_v=factories.soc_profile(G, capacity, s) soc_profile_cs_v=soc_profile_factory(G, capacity, s)
) )
l_uns[s].insert( l_uns[s].insert(
...@@ -87,7 +87,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node, ...@@ -87,7 +87,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
t_trip=t_trip_old + t_charge, t_trip=t_trip_old + t_charge,
soc_last_cs=old_soc_function(t_trip_old + t_charge), soc_last_cs=old_soc_function(t_trip_old + t_charge),
last_cs=minimum_node, last_cs=minimum_node,
soc_profile_cs_v=factories.soc_profile( soc_profile_cs_v=soc_profile_factory(
G, capacity, minimum_node G, capacity, minimum_node
) )
) )
...@@ -109,7 +109,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node, ...@@ -109,7 +109,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
for n in G.neighbors(minimum_node): for n in G.neighbors(minimum_node):
# Create SoC Profile for getting from minimum_node to n # Create SoC Profile for getting from minimum_node to n
soc_profile = label_minimum_node.soc_profile_cs_v + \ soc_profile = label_minimum_node.soc_profile_cs_v + \
factories.soc_profile(G, capacity, minimum_node, n) soc_profile_factory(G, capacity, minimum_node, n)
if not soc_profile(capacity) == -inf: if not soc_profile(capacity) == -inf:
# It is possible to get from minimum_node to n # It is possible to get from minimum_node to n
l_new = Label( l_new = Label(
......
import itertools import itertools
from typing import Any from typing import Any
from heapq import * from heapq import heappush, heappop
class PriorityQueue: class PriorityQueue:
......
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