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
    • Method Detail

      • computeCostInHours

        protected double computeCostInHours​(MacroscopicLinkSegment linkSegment,
                                            Mode mode,
                                            double flowPcuPerHour)
        BPR function computation for
        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
      • getSegmentCost

        public double getSegmentCost​(Mode mode,
                                     MacroscopicLinkSegment linkSegment)
                              throws PlanItException
        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:
        getSegmentCost 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)
        Throws:
        PlanItException - when cost cannot be computed
      • populateWithCost

        public void populateWithCost​(Mode mode,
                                     double[] costToFill)
                              throws PlanItException
        populate the cost array with the BPR link travel times for all link segments for the specified mode
        Specified by:
        populateWithCost in class AbstractPhysicalCost
        Parameters:
        mode - the mode to use
        costToFill - the cost to populate (in hours)
        Throws:
        PlanItException - thrown if error
      • setLinkVolumeAccessee

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