Newer
Older
from math import inf
from evrouting.utils import PriorityQueue
from .T import Label
from .factories import SoCFunctionFactory
def __init__(self, f_soc: SoCFunctionFactory, l_set: Set[Label]):
t_min: Time = soc_function.minimum
# Might happen because of dummy charge stations
if t_min == -inf:
raise ValueError('Infeasible label.')
soc_min: SoC = soc_function(t_min)
super().insert(
item=label,
priority=t_min,
count=soc_min
)
if self.peak_min() == label:
self.dominance_check()
def delete_min(self) -> Any:
min_label = super().delete_min()
self.dominance_check()
return min_label
def dominance_check(self):
try:
label: Label = self.peak_min()
except KeyError:
return