Class InitialLinkSegmentCost

    • Field Detail

      • timePeriodAgnosticCosts

        protected final InitialModesLinkSegmentCost timePeriodAgnosticCosts
        Store initial cost for each mode and link segment, not linked to a particular time period
    • Constructor Detail

      • InitialLinkSegmentCost

        public InitialLinkSegmentCost​(IdGroupingToken groupId)
        Constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
      • InitialLinkSegmentCost

        public InitialLinkSegmentCost​(InitialLinkSegmentCost other)
        Copy constructor
        Parameters:
        other - to copy
    • Method Detail

      • getSegmentCost

        protected double getSegmentCost​(InitialModesLinkSegmentCost initialCostsByMode,
                                        Mode mode,
                                        MacroscopicLinkSegment linkSegment)
        Returns the initial cost. When absent but mode is not allowed on link segment, positive infinity is used, otherwise we revert to free flow travel time and a warning is logged.
        Parameters:
        initialCostsByMode - to use
        mode - the current mode
        linkSegment - the current link segment
        Returns:
        the cost for this link segment and mode
      • isSegmentCostsSetForMode

        public boolean isSegmentCostsSetForMode​(Mode mode)
        Are link segment costs available for the given mode (without time period)
        Specified by:
        isSegmentCostsSetForMode in class InitialPhysicalCost
        Parameters:
        mode - the mode
        Returns:
        true when available, false otherwise
      • isSegmentCostsSetForTimePeriod

        public boolean isSegmentCostsSetForTimePeriod​(TimePeriod timePeriod)
        Are link segment costs available for the given time period
        Specified by:
        isSegmentCostsSetForTimePeriod in class InitialPhysicalCost
        Parameters:
        timePeriod - the time period
        Returns:
        true when available, false otherwise
      • isSegmentCostsSetForMode

        public boolean isSegmentCostsSetForMode​(TimePeriod timePeriod,
                                                Mode mode)
        Are link segment costs available for the given mode (without time period)
        Specified by:
        isSegmentCostsSetForMode in class InitialPhysicalCost
        Parameters:
        timePeriod - to use
        mode - the mode
        Returns:
        true when available, false otherwise
      • getGeneralisedCost

        public double getGeneralisedCost​(Mode mode,
                                         MacroscopicLinkSegment linkSegment)
        Returns the initial cost for each link segment and mode for time period agnostic registrations. When absent but mode is not allowed on link segment, positive infinity is used, otherwise we revert to free flow travel time and a warning is logged.
        Specified by:
        getGeneralisedCost in interface Cost<MacroscopicLinkSegment>
        Specified by:
        getGeneralisedCost in class InitialPhysicalCost
        Parameters:
        mode - the current mode
        linkSegment - the current link segment
        Returns:
        the cost for this link segment and mode
      • getSegmentCost

        public double getSegmentCost​(TimePeriod timePeriod,
                                     Mode mode,
                                     MacroscopicLinkSegment linkSegment)
        Returns the initial cost for each link segment and mode for time period specific registrations. When absent but mode is not allowed on link segment, positive infinity is used, otherwise we revert to free flow travel time and a warning is logged.
        Specified by:
        getSegmentCost in class InitialPhysicalCost
        Parameters:
        timePeriod - the time period
        mode - the current mode
        linkSegment - the current link segment
        Returns:
        the cost for this link segment and mode
      • setSegmentCost

        public void setSegmentCost​(Mode mode,
                                   MacroscopicLinkSegment linkSegment,
                                   double cost)
        Set the initial cost for a specified mode and link segment
        Specified by:
        setSegmentCost in class InitialPhysicalCost
        Parameters:
        mode - the current mode
        linkSegment - the current link segment
        cost - the initial cost for this mode and link segment
      • setSegmentCost

        public void setSegmentCost​(TimePeriod timePeriod,
                                   Mode mode,
                                   MacroscopicLinkSegment linkSegment,
                                   double cost)
        Set the initial cost for a specified mode and link segment
        Specified by:
        setSegmentCost in class InitialPhysicalCost
        Parameters:
        timePeriod - the timePeriod for which the cost is specifically meant
        mode - the current mode
        linkSegment - the current link segment
        cost - the initial cost for this mode and link segment
      • getTimePeriodAgnosticCosts

        public InitialModesLinkSegmentCost getTimePeriodAgnosticCosts()
        Provide the time period agnostic costs
        Returns:
        time period agnostic costs
      • getTimePeriodCosts

        public InitialModesLinkSegmentCost getTimePeriodCosts​(TimePeriod timePeriod)
        The time period specific costs available
        Parameters:
        timePeriod - to collect for
        Returns:
        costs registered, null if not present
      • getTimePeriods

        public Set<TimePeriod> getTimePeriods()
        The registered time periods that have initial costs
        Returns:
        time periods
      • getTravelTimeCost

        public double getTravelTimeCost​(Mode mode,
                                        MacroscopicLinkSegment linkSegment)
        Returns the generalised cost of travel along an edge segment for a specified mode
        Parameters:
        mode - the specified mode of travel
        linkSegment - the specified edge segment (which can be physical or virtual)
        Returns:
        the cost of travel along the specified segment
      • getDTravelTimeDFlow

        public double getDTravelTimeDFlow​(boolean uncongested,
                                          Mode mode,
                                          MacroscopicLinkSegment linkSegment)
        Not supported returns -infinity for all calls and logs severe warning
        Parameters:
        uncongested - flag idicating if the provided flow is uncongested or congested flow, relevant when flow can represent multiple traffic states
        mode - to use
        linkSegment - to use
        Returns:
        the first derivative of travel time for a unit flow rate change in PCU per Hour