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

wip

parent 2f5f28b0
No related branches found
No related tags found
1 merge request!1Working np Algorithm
......@@ -25,18 +25,18 @@ class ChargingFunction:
class SoCFunction:
def __init__(self, G: nx.Graph, l: Label):
def __init__(self, G: nx.Graph, l: Label, U: SoC):
self.t_trip: Time = l.t_trip
self.beta_u: SoC = l.beta_u
self.u: Node = l.u
self.b_u_v: SoCProfile = l.SoCProfile_u_v
self.c_u: ChargingCoefficient = charging_cofficient(G, l.u)
self.cf: ChargingFunction = ChargingFunction(G, l.u, U)
def __call__(self, t) -> SoC:
if t < self.t_trip:
return -inf
return self.beta_u(self.beta_u + self.c_u * (t - self.t_trip))
return self.b_u_v(self.cf(t - self.t_trip, self.beta_u))
def get_minimum(self) -> Time:
"""TODO: Explain."""
......
......@@ -5,7 +5,7 @@ import networkx as nx
from evrouting.T import Node, SoC, Time, ChargingCoefficient
from evrouting.utils import PriorityQueue
from .T import SoCProfile, ChargingFunction, Label
from .T import SoCProfile, SoCFunction, Label
def shortest_path(G: nx.Graph, S: set, s: Node, t: Node, beta_s: SoC, beta_t: SoC, U: SoC):
......@@ -50,7 +50,7 @@ def shortest_path(G: nx.Graph, S: set, s: Node, t: Node, beta_s: SoC, beta_t: So
l_set[v].add(l)
if v == t:
return ChargingFunction(G, l).get_minimum()
return SoCFunction(G, l, U).get_minimum()
# handle charging stations
t_trip, beta_u, u, b_u_v = l
......
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