Class BPRLinkTravelTimeCost

    • Field Detail

      • linkVolumeAccessee

        protected LinkVolumeAccessee linkVolumeAccessee
        Link volume accessee object for this cost function
      • defaultParameters

        protected Pair<Double,​Double> defaultParameters
        Default alpha and beta values for all links
      • bprParametersPerLinkSegment

        protected BPRLinkTravelTimeCost.BPRParameters[] bprParametersPerLinkSegment
        Array to store BPRParameters objects for each link segment to be used in calculateSegmentCost()
      • freeFlowTravelTimePerLinkSegment

        protected double[][] freeFlowTravelTimePerLinkSegment
        2d Array to store free flow travel time for each [mode][link segment] to be used in calculateSegmentCost()
      • DEFAULT_ALPHA

        public static final double DEFAULT_ALPHA
        Default alpha BPR parameter if not other information is available
        See Also:
        Constant Field Values
      • DEFAULT_BETA

        public static final double DEFAULT_BETA
        Default beta BPR parameter if not other information is available
        See Also:
        Constant Field Values
    • Constructor Detail

      • BPRLinkTravelTimeCost

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

        public BPRLinkTravelTimeCost​(BPRLinkTravelTimeCost bprLinkTravelTimeCost)
        Copy Constructor
        Parameters:
        bprLinkTravelTimeCost - to use
    • Method Detail

      • computeCostInHours

        protected double computeCostInHours​(MacroscopicLinkSegment linkSegment,
                                            Mode mode,
                                            double flowPcuPerHour)
        BPR function computation for. In case mode is nto allowed Double.MAX_VALUE is returned
        Parameters:
        linkSegment - the link segment
        mode - given mode
        flowPcuPerHour - available flow
        Returns:
        travel time in hours
      • setParameters

        public void setParameters​(MacroscopicLinkSegment linkSegment,
                                  Mode mode,
                                  double alpha,
                                  double beta)
        Set the alpha and beta values for a given link segment and mode
        Parameters:
        linkSegment - the specified link segment
        mode - specified mode type
        alpha - alpha value
        beta - beta value
      • setDefaultParameters

        public void setDefaultParameters​(Mode mode,
                                         double alpha,
                                         double beta)
        Set the default alpha and beta values for a mode
        Parameters:
        mode - the specified mode type
        alpha - alpha value
        beta - beta value
      • setDefaultParameters

        public void setDefaultParameters​(MacroscopicLinkSegmentType macroscopicLinkSegmentType,
                                         Mode mode,
                                         double alpha,
                                         double beta)
        Set the default alpha and beta values for a given link type and mode
        Parameters:
        macroscopicLinkSegmentType - the specified link type
        mode - the specified mode type
        alpha - alpha value
        beta - beta value
      • setDefaultParameters

        public void setDefaultParameters​(double alpha,
                                         double beta)
        Set the default alpha and beta values
        Parameters:
        alpha - alpha value
        beta - beta value
      • updateTimePeriod

        public void updateTimePeriod​(TimePeriod timePeriod)
        Provide the cost calculation with information regarding the time period for which the cost is to be calculated
        Specified by:
        updateTimePeriod in class AbstractPhysicalCost
        Parameters:
        timePeriod - to apply
      • getGeneralisedCost

        public double getGeneralisedCost​(Mode mode,
                                         MacroscopicLinkSegment linkSegment)
        Return the travel time for the current link for a given mode If the input data are invalid, this method returns a negative value.
        Specified by:
        getGeneralisedCost in interface Cost<MacroscopicLinkSegment>
        Parameters:
        mode - the current Mode of travel
        linkSegment - the current link segment
        Returns:
        the travel time for the current link (in hours)
      • getTravelTimeCost

        public double getTravelTimeCost​(Mode mode,
                                        MacroscopicLinkSegment linkSegment)
        Returns the generalised cost of travel along an edge segment for a specified mode
        Specified by:
        getTravelTimeCost in interface Cost<MacroscopicLinkSegment>
        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)
        Get the first derivative of the used travel time computation method towards the edge segment (in) flow rate in PCU per hour, i.e. dTraveltime//dFlow.
        Specified by:
        getDTravelTimeDFlow in interface Cost<MacroscopicLinkSegment>
        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
      • populateWithCost

        public void populateWithCost​(UntypedPhysicalLayer<?,​?,​?> physicalLayer,
                                     Mode mode,
                                     double[] costToFill)
                              throws PlanItException
        populate the cost array with the BPR link travel times for all link segments for the specified mode
        Overrides:
        populateWithCost in class AbstractPhysicalCost
        Parameters:
        mode - the mode to use
        costToFill - the cost to populate (in hours)
        physicalLayer - these cost pertain to
        Throws:
        PlanItException - thrown if error
      • setAccessee

        public void setAccessee​(LinkVolumeAccessee linkVolumeAccessee)
        we expect a link volume accessee to be provided by the environment. This is our point of access
        Specified by:
        setAccessee in interface InteractorAccessor<LinkVolumeAccessee>
        Parameters:
        linkVolumeAccessee - the accessee to extract link volumes from