Source code for aequilibrae.paths.vdf

from aequilibrae.paths.AoN import (
    bpr,
    delta_bpr,
    bpr2,
    delta_bpr2,
    conical,
    delta_conical,
    inrets,
    delta_inrets,
    akcelik,
    delta_akcelik,
)

all_vdf_functions = ["bpr", "bpr2", "conical", "inrets", "akcelik"]


[docs] class VDF: """Volume-Delay function .. code-block:: python >>> from aequilibrae.paths import VDF >>> vdf = VDF() >>> vdf.functions_available() ['bpr', 'bpr2', 'conical', 'inrets', 'akcelik'] """ def __init__(self): self.__dict__["function"] = "" self.__dict__["apply_vdf"] = None self.__dict__["apply_derivative"] = None def __setattr__(self, instance, value) -> None: if instance == "function": value = value.upper() self.__dict__[instance] = value if value == "BPR": self.__dict__["apply_vdf"] = bpr self.__dict__["apply_derivative"] = delta_bpr elif value == "BPR2": self.__dict__["apply_vdf"] = bpr2 self.__dict__["apply_derivative"] = delta_bpr2 elif value == "CONICAL": self.__dict__["apply_vdf"] = conical self.__dict__["apply_derivative"] = delta_conical elif value == "INRETS": self.__dict__["apply_vdf"] = inrets self.__dict__["apply_derivative"] = delta_inrets elif value == "AKCELIK": self.__dict__["apply_vdf"] = akcelik self.__dict__["apply_derivative"] = delta_akcelik else: raise ValueError("VDF function not available") else: raise AttributeError("This class only allows you to set the VDF to use")
[docs] def functions_available(self) -> list: """returns a list of all functions available""" return all_vdf_functions