Class InitialLinkSegmentCost
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<InitialPhysicalCost>
-
- org.goplanit.cost.physical.initial.InitialPhysicalCost
-
- org.goplanit.cost.physical.initial.InitialLinkSegmentCost
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IdAble>,EventListener,PlanitComponentListener,Cost<MacroscopicLinkSegment>,PhysicalCost,EventListener,ExternalIdAble,IdAble
- Direct Known Subclasses:
ManualInitialLinkSegmentCost
public class InitialLinkSegmentCost extends InitialPhysicalCost
Initial Link Segment Costs stored by mode- Author:
- gman6028, markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected InitialModesLinkSegmentCosttimePeriodAgnosticCostsStore initial cost for each mode and link segment, not linked to a particular time periodprotected Map<TimePeriod,InitialModesLinkSegmentCost>timePeriodCostsMap to store initial cost for each mode and link segment, linked to a particular time period-
Fields inherited from interface org.goplanit.cost.physical.PhysicalCost
BPR, FREEFLOW, STEADY_STATE
-
-
Constructor Summary
Constructors Constructor Description InitialLinkSegmentCost(InitialLinkSegmentCost other)Copy constructorInitialLinkSegmentCost(IdGroupingToken groupId)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InitialLinkSegmentCostclone()Create a shallow copy of this entitydoublegetDTravelTimeDFlow(boolean uncongested, Mode mode, MacroscopicLinkSegment linkSegment)Not supported returns -infinity for all calls and logs severe warningdoublegetGeneralisedCost(Mode mode, MacroscopicLinkSegment linkSegment)Returns the initial cost for each link segment and mode for time period agnostic registrations.protected doublegetSegmentCost(InitialModesLinkSegmentCost initialCostsByMode, Mode mode, MacroscopicLinkSegment linkSegment)Returns the initial cost.doublegetSegmentCost(TimePeriod timePeriod, Mode mode, MacroscopicLinkSegment linkSegment)Returns the initial cost for each link segment and mode for time period specific registrations.InitialModesLinkSegmentCostgetTimePeriodAgnosticCosts()Provide the time period agnostic costsInitialModesLinkSegmentCostgetTimePeriodCosts(TimePeriod timePeriod)The time period specific costs availableSet<TimePeriod>getTimePeriods()The registered time periods that have initial costsdoublegetTravelTimeCost(Mode mode, MacroscopicLinkSegment linkSegment)Returns the generalised cost of travel along an edge segment for a specified modebooleanisSegmentCostsSetForMode(Mode mode)Are link segment costs available for the given mode (without time period)booleanisSegmentCostsSetForMode(TimePeriod timePeriod, Mode mode)Are link segment costs available for the given mode (without time period)booleanisSegmentCostsSetForTimePeriod(TimePeriod timePeriod)Are link segment costs available for the given time periodvoidreset()All components should be able to reset going back to some representative initial statevoidsetSegmentCost(Mode mode, long linkSegmentId, double cost)same assetSegmentCost(Mode, MacroscopicLinkSegment, double)only based on link segment's idvoidsetSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment, double cost)Set the initial cost for a specified mode and link segmentvoidsetSegmentCost(TimePeriod timePeriod, Mode mode, MacroscopicLinkSegment linkSegment, double cost)Set the initial cost for a specified mode and link segment-
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
-
-
-
-
Field Detail
-
timePeriodAgnosticCosts
protected final InitialModesLinkSegmentCost timePeriodAgnosticCosts
Store initial cost for each mode and link segment, not linked to a particular time period
-
timePeriodCosts
protected Map<TimePeriod,InitialModesLinkSegmentCost> timePeriodCosts
Map to store initial cost for each mode and link segment, 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 usemode- the current modelinkSegment- 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:
isSegmentCostsSetForModein classInitialPhysicalCost- 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:
isSegmentCostsSetForTimePeriodin classInitialPhysicalCost- 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:
isSegmentCostsSetForModein classInitialPhysicalCost- Parameters:
timePeriod- to usemode- 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:
getGeneralisedCostin interfaceCost<MacroscopicLinkSegment>- Specified by:
getGeneralisedCostin classInitialPhysicalCost- Parameters:
mode- the current modelinkSegment- 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:
getSegmentCostin classInitialPhysicalCost- Parameters:
timePeriod- the time periodmode- the current modelinkSegment- 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:
setSegmentCostin classInitialPhysicalCost- Parameters:
mode- the current modelinkSegment- the current link segmentcost- 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:
setSegmentCostin classInitialPhysicalCost- Parameters:
timePeriod- the timePeriod for which the cost is specifically meantmode- the current modelinkSegment- the current link segmentcost- the initial cost for this mode and link segment
-
setSegmentCost
public void setSegmentCost(Mode mode, long linkSegmentId, double cost)
same assetSegmentCost(Mode, MacroscopicLinkSegment, double)only based on link segment's id
-
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
-
clone
public InitialLinkSegmentCost clone()
Create a shallow copy of this entity- Specified by:
clonein interfaceIdAble- Specified by:
clonein classPlanitComponent<InitialPhysicalCost>- Returns:
- shallow copy of entity
-
reset
public void reset()
All components should be able to reset going back to some representative initial state- Specified by:
resetin classPlanitComponent<InitialPhysicalCost>
-
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 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)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 statesmode- to uselinkSegment- to use- Returns:
- the first derivative of travel time for a unit flow rate change in PCU per Hour
-
-