Class InitialMacroscopicLinkSegmentCost
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<InitialPhysicalCost>
-
- org.goplanit.cost.physical.initial.InitialPhysicalCost
-
- org.goplanit.cost.physical.initial.InitialMacroscopicLinkSegmentCost
-
- All Implemented Interfaces:
Serializable,Comparable<IdAble>,EventListener,PlanitComponentListener,Cost<MacroscopicLinkSegment>,PhysicalCost<MacroscopicLinkSegment>,EventListener,ExternalIdAble,IdAble
- Direct Known Subclasses:
FixedInitialMacroscopicLinkSegmentCost
public class InitialMacroscopicLinkSegmentCost extends InitialPhysicalCost implements PhysicalCost<MacroscopicLinkSegment>
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 InitialMacroscopicLinkSegmentCost(InitialMacroscopicLinkSegmentCost other, boolean deepCopy)Copy constructorInitialMacroscopicLinkSegmentCost(IdGroupingToken groupId)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>collectSettingsAsKeyValueMap()Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entityInitialMacroscopicLinkSegmentCostdeepClone()deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possibledoublegetDTravelTimeDFlow(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 segmentInitialMacroscopicLinkSegmentCostshallowClone()Create a shallow copy of this entity-
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
clone, 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
appendExternalId, appendExternalId, getIdsAsString, getSplitExternalId, getSplitExternalId, hasExternalId, hasXmlId, setXmlId
-
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
-
InitialMacroscopicLinkSegmentCost
public InitialMacroscopicLinkSegmentCost(IdGroupingToken groupId)
Constructor- Parameters:
groupId- contiguous id generation within this group for instances of this class
-
InitialMacroscopicLinkSegmentCost
public InitialMacroscopicLinkSegmentCost(InitialMacroscopicLinkSegmentCost other, boolean deepCopy)
Copy constructor- Parameters:
other- to copydeepCopy- when true, create a eep copy, shallow copy otherwise
-
-
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
-
shallowClone
public InitialMacroscopicLinkSegmentCost shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein classInitialPhysicalCost- Returns:
- shallow copy of entity
-
deepClone
public InitialMacroscopicLinkSegmentCost deepClone()
deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possible- Specified by:
deepClonein interfaceIdAble- Specified by:
deepClonein classInitialPhysicalCost- Returns:
- deep 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- 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)Not supported returns -infinity for all calls and logs severe warning- 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
-
collectSettingsAsKeyValueMap
public Map<String,String> collectSettingsAsKeyValueMap()
Provide all the settings of this particular component by name and value, where each value is a string representation of the underlying entity- Specified by:
collectSettingsAsKeyValueMapin classPlanitComponent<InitialPhysicalCost>- Returns:
- name-value map of all (user configurable) settings
-
-