Package org.goplanit.cost.physical
Class BPRLinkTravelTimeCost
- java.lang.Object
 - 
- org.goplanit.component.PlanitComponent<AbstractPhysicalCost>
 - 
- org.goplanit.cost.physical.AbstractPhysicalCost
 - 
- org.goplanit.cost.physical.BPRLinkTravelTimeCost
 
 
 
 
- 
- All Implemented Interfaces:
 Serializable,Cloneable,Comparable<IdAble>,EventListener,PlanitComponentListener,Cost<MacroscopicLinkSegment>,PhysicalCost,InteractorAccessor<LinkVolumeAccessee>,LinkVolumeAccessor,EventListener,ExternalIdAble,IdAble
public class BPRLinkTravelTimeCost extends AbstractPhysicalCost implements LinkVolumeAccessor
Well known BPR link performance function to compute travel time cost on link segment based on flow and configuration parameters. An instance of this class is compatible with a single macroscopic physical network (layer)- Author:
 - markr
 - See Also:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description classBPRLinkTravelTimeCost.BPRParametersInner 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[]bprParametersPerLinkSegmentArray to store BPRParameters objects for each link segment to be used in calculateSegmentCost()static doubleDEFAULT_ALPHADefault alpha BPR parameter if not other information is availablestatic doubleDEFAULT_BETADefault beta BPR parameter if not other information is availableprotected Pair<Double,Double>defaultParametersDefault alpha and beta values for all linksprotected Map<MacroscopicLinkSegmentType,BPRLinkTravelTimeCost.BPRParameters>defaultParametersPerLinkSegmentTypeAndModeMap to store default alpha and beta values for each link type and modeprotected BPRLinkTravelTimeCost.BPRParametersdefaultParametersPerModeMap to store default alpha and beta values for each modeprotected double[][]freeFlowTravelTimePerLinkSegment2d Array to store free flow travel time for each [mode][link segment] to be used in calculateSegmentCost()protected LinkVolumeAccesseelinkVolumeAccesseeLink volume accessee object for this cost functionprotected Map<MacroscopicLinkSegment,BPRLinkTravelTimeCost.BPRParameters>parametersPerLinkSegmentAndModeMap to store default alpha and beta values for a specific link segment- 
Fields inherited from interface org.goplanit.cost.physical.PhysicalCost
BPR, FREEFLOW, STEADY_STATE 
 - 
 
- 
Constructor Summary
Constructors Constructor Description BPRLinkTravelTimeCost(BPRLinkTravelTimeCost bprLinkTravelTimeCost)Copy ConstructorBPRLinkTravelTimeCost(IdGroupingToken groupId)Constructor 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BPRLinkTravelTimeCostclone()Create a shallow copy of this entityprotected doublecomputeCostInHours(MacroscopicLinkSegment linkSegment, Mode mode, double flowPcuPerHour)BPR function computation for.doublegetDTravelTimeDFlow(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.doublegetGeneralisedCost(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.doublegetTravelTimeCost(Mode mode, MacroscopicLinkSegment linkSegment)Returns the generalised cost of travel along an edge segment for a specified modevoidinitialiseBeforeSimulation(TransportLayerNetwork<?,?> network)Register the BPR cost parameter values on the PhysicalNetworkvoidpopulateWithCost(UntypedPhysicalLayer<?,?,?> physicalLayer, Mode mode, double[] costToFill)populate the cost array with the BPR link travel times for all link segments for the specified modevoidreset()return to pre-initialiseBeforeSimulation(TransportLayerNetwork)statevoidsetAccessee(LinkVolumeAccessee linkVolumeAccessee)we expect a link volume accessee to be provided by the environment.voidsetDefaultParameters(double alpha, double beta)Set the default alpha and beta valuesvoidsetDefaultParameters(Mode mode, double alpha, double beta)Set the default alpha and beta values for a modevoidsetDefaultParameters(MacroscopicLinkSegmentType macroscopicLinkSegmentType, Mode mode, double alpha, double beta)Set the default alpha and beta values for a given link type and modevoidsetParameters(MacroscopicLinkSegment linkSegment, Mode mode, double alpha, double beta)Set the alpha and beta values for a given link segment and modevoidupdateTimePeriod(TimePeriod timePeriod)Provide the cost calculation with information regarding the time period for which the cost is to be calculated- 
Methods inherited from class org.goplanit.component.PlanitComponent
equals, getComponentType, getExternalId, getId, getIdGroupingToken, getKnownSupportedEventTypes, getXmlId, hashCode, onPlanitComponentEvent, setExternalId, setXmlId 
- 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes 
- 
Methods inherited from interface org.goplanit.utils.id.ExternalIdAble
hasExternalId, hasXmlId 
- 
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode 
- 
Methods inherited from interface org.goplanit.interactor.InteractorAccessor
setAccessee 
- 
Methods inherited from interface org.goplanit.interactor.LinkVolumeAccessor
getCompatibleAccessee 
 - 
 
 - 
 
- 
- 
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 
- 
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() 
- 
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 segmentmode- given modeflowPcuPerHour- 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 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(TransportLayerNetwork<?,?> network) throws PlanItException
Register the BPR cost parameter values on the PhysicalNetwork- Specified by:
 initialiseBeforeSimulationin classAbstractPhysicalCost- Parameters:
 network- network object containing the updated parameter values- Throws:
 PlanItException- thrown if error
 
- 
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:
 updateTimePeriodin classAbstractPhysicalCost- 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:
 getGeneralisedCostin interfaceCost<MacroscopicLinkSegment>- Parameters:
 mode- the current Mode of travellinkSegment- 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:
 getTravelTimeCostin interfaceCost<MacroscopicLinkSegment>- Parameters:
 mode- the specified mode of travellinkSegment- 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:
 getDTravelTimeDFlowin interfaceCost<MacroscopicLinkSegment>- Parameters:
 uncongested- flag idicating if the provided flow is uncongested or congested flow, relevant when flow can represent multiple traffic statesmode- to uselinkSegment- 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:
 populateWithCostin classAbstractPhysicalCost- Parameters:
 mode- the mode to usecostToFill- 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:
 setAccesseein interfaceInteractorAccessor<LinkVolumeAccessee>- Parameters:
 linkVolumeAccessee- the accessee to extract link volumes from
 
- 
clone
public BPRLinkTravelTimeCost clone()
Create a shallow copy of this entity- Specified by:
 clonein interfaceIdAble- Specified by:
 clonein classPlanitComponent<AbstractPhysicalCost>- Returns:
 - shallow copy of entity
 
 
- 
reset
public void reset()
return to pre-initialiseBeforeSimulation(TransportLayerNetwork)state- Specified by:
 resetin classPlanitComponent<AbstractPhysicalCost>
 
 - 
 
 -