Package org.planit.cost.physical
Class BPRLinkTravelTimeCost
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.trafficassignment.TrafficAssignmentComponent<PhysicalCost>
-
- org.planit.cost.physical.PhysicalCost
-
- org.planit.cost.physical.BPRLinkTravelTimeCost
-
- All Implemented Interfaces:
Serializable
,EventListener
,org.djutils.event.EventListenerInterface
,org.djutils.event.EventProducerInterface
,Cost<LinkSegment>
,AbstractPhysicalCost
,InteractorAccessor
,LinkVolumeAccessor
public class BPRLinkTravelTimeCost extends PhysicalCost implements LinkVolumeAccessor
Well known BPR link performance function to compute travel time cost on link segment based on flow and configuration parameters.- Author:
- markr
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BPRLinkTravelTimeCost.BPRParameters
Inner class to store Map of alpha and beta parameters used in BPR function for each mode
-
Field Summary
Fields Modifier and Type Field Description protected BPRLinkTravelTimeCost.BPRParameters[]
bprParametersPerLinkSegment
Array to store BPRParameters objects for each link segment to be used in calculateSegmentCost()static double
DEFAULT_ALPHA
Default alpha BPR parameter if not other information is availablestatic double
DEFAULT_BETA
Default beta BPR parameter if not other information is availableprotected Pair<Double,Double>
defaultParameters
Default alpha and beta values for all linksprotected Map<MacroscopicLinkSegmentType,BPRLinkTravelTimeCost.BPRParameters>
defaultParametersPerLinkSegmentTypeAndMode
Map to store default alpha and beta values for each link type and modeprotected BPRLinkTravelTimeCost.BPRParameters
defaultParametersPerMode
Map to store default alpha and beta values for each modeprotected LinkVolumeAccessee
linkVolumeAccessee
Link volume accessee object for this cost functionprotected Map<MacroscopicLinkSegment,BPRLinkTravelTimeCost.BPRParameters>
parametersPerLinkSegmentAndMode
Map to store default alpha and beta values for a specific link segment-
Fields inherited from class org.planit.cost.physical.PhysicalCost
BPR
-
Fields inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
groupId, id, trafficComponentType
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
Fields inherited from interface org.planit.interactor.LinkVolumeAccessor
INTERACTOR_REQUEST_LINKVOLUMEACCESSEE_TYPE
-
-
Constructor Summary
Constructors Constructor Description BPRLinkTravelTimeCost(IdGroupingToken groupId)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getSegmentCost(Mode mode, LinkSegment 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.void
initialiseBeforeSimulation(PhysicalNetwork physicalNetwork)
Register the BPR cost parameter values on the PhysicalNetwork Call this method after all the calls to set the cost parameters have been madevoid
notify(org.djutils.event.EventInterface event)
we wait for a link volume accessee to be provided after it is requested.void
setDefaultParameters(double alpha, double beta)
Set the default alpha and beta valuesvoid
setDefaultParameters(MacroscopicLinkSegmentType macroscopicLinkSegmentType, Mode mode, double alpha, double beta)
Set the default alpha and beta values for a given link type and modevoid
setDefaultParameters(Mode mode, double alpha, double beta)
Set the default alpha and beta values for a modevoid
setParameters(MacroscopicLinkSegment linkSegment, Mode mode, double alpha, double beta)
Set the alpha and beta values for a given link segment and mode-
Methods inherited from class org.planit.trafficassignment.TrafficAssignmentComponent
getId, getIdGroupingtoken, getSourceId, getTrafficComponentType
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.interactor.LinkVolumeAccessor
getRequestedAccesseeEventType
-
-
-
-
Field Detail
-
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
-
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
-
defaultParametersPerMode
protected BPRLinkTravelTimeCost.BPRParameters defaultParametersPerMode
Map to store default alpha and beta values for each mode
-
defaultParametersPerLinkSegmentTypeAndMode
protected Map<MacroscopicLinkSegmentType,BPRLinkTravelTimeCost.BPRParameters> defaultParametersPerLinkSegmentTypeAndMode
Map to store default alpha and beta values for each link type and mode
-
parametersPerLinkSegmentAndMode
protected Map<MacroscopicLinkSegment,BPRLinkTravelTimeCost.BPRParameters> parametersPerLinkSegmentAndMode
Map to store default alpha and beta values for a specific link segment
-
bprParametersPerLinkSegment
protected BPRLinkTravelTimeCost.BPRParameters[] bprParametersPerLinkSegment
Array to store BPRParameters objects for each link segment to be used in calculateSegmentCost()
-
-
Constructor Detail
-
BPRLinkTravelTimeCost
public BPRLinkTravelTimeCost(IdGroupingToken groupId)
Constructor- Parameters:
groupId
- , contiguous id generation within this group for instances of this class
-
-
Method Detail
-
getSegmentCost
public double getSegmentCost(Mode mode, LinkSegment 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 interfaceCost<LinkSegment>
- Parameters:
mode
- the current Mode of travellinkSegment
- the current link segment- Returns:
- the travel time for the current link
- Throws:
PlanItException
- when cost cannot be computed
-
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 segmentmode
- specified mode typealpha
- alpha valuebeta
- 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 typealpha
- alpha valuebeta
- 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 typemode
- the specified mode typealpha
- alpha valuebeta
- beta value
-
setDefaultParameters
public void setDefaultParameters(double alpha, double beta)
Set the default alpha and beta values- Parameters:
alpha
- alpha valuebeta
- beta value
-
initialiseBeforeSimulation
public void initialiseBeforeSimulation(PhysicalNetwork physicalNetwork)
Register the BPR cost parameter values on the PhysicalNetwork Call this method after all the calls to set the cost parameters have been made- Specified by:
initialiseBeforeSimulation
in classPhysicalCost
- Parameters:
physicalNetwork
- PhysicalNetwork object containing the updated parameter values
-
notify
public void notify(org.djutils.event.EventInterface event) throws RemoteException
we wait for a link volume accessee to be provided after it is requested. Here we get notified- Specified by:
notify
in interfaceorg.djutils.event.EventListenerInterface
- Throws:
RemoteException
-
-