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 InitialModesLinkSegmentCost
timePeriodAgnosticCosts
Store initial cost for each mode and link segment, not linked to a particular time periodprotected Map<TimePeriod,InitialModesLinkSegmentCost>
timePeriodCosts
Map 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 entityInitialMacroscopicLinkSegmentCost
deepClone()
deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possibledouble
getDTravelTimeDFlow(boolean uncongested, Mode mode, MacroscopicLinkSegment linkSegment)
Not supported returns -infinity for all calls and logs severe warningdouble
getGeneralisedCost(Mode mode, MacroscopicLinkSegment linkSegment)
Returns the initial cost for each link segment and mode for time period agnostic registrations.protected double
getSegmentCost(InitialModesLinkSegmentCost initialCostsByMode, Mode mode, MacroscopicLinkSegment linkSegment)
Returns the initial cost.double
getSegmentCost(TimePeriod timePeriod, Mode mode, MacroscopicLinkSegment linkSegment)
Returns the initial cost for each link segment and mode for time period specific registrations.InitialModesLinkSegmentCost
getTimePeriodAgnosticCosts()
Provide the time period agnostic costsInitialModesLinkSegmentCost
getTimePeriodCosts(TimePeriod timePeriod)
The time period specific costs availableSet<TimePeriod>
getTimePeriods()
The registered time periods that have initial costsdouble
getTravelTimeCost(Mode mode, MacroscopicLinkSegment linkSegment)
Returns the generalised cost of travel along an edge segment for a specified modeboolean
isSegmentCostsSetForMode(Mode mode)
Are link segment costs available for the given mode (without time period)boolean
isSegmentCostsSetForMode(TimePeriod timePeriod, Mode mode)
Are link segment costs available for the given mode (without time period)boolean
isSegmentCostsSetForTimePeriod(TimePeriod timePeriod)
Are link segment costs available for the given time periodvoid
reset()
All components should be able to reset going back to some representative initial statevoid
setSegmentCost(Mode mode, long linkSegmentId, double cost)
same assetSegmentCost(Mode, MacroscopicLinkSegment, double)
only based on link segment's idvoid
setSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment, double cost)
Set the initial cost for a specified mode and link segmentvoid
setSegmentCost(TimePeriod timePeriod, Mode mode, MacroscopicLinkSegment linkSegment, double cost)
Set the initial cost for a specified mode and link segmentInitialMacroscopicLinkSegmentCost
shallowClone()
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:
isSegmentCostsSetForMode
in 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:
isSegmentCostsSetForTimePeriod
in 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:
isSegmentCostsSetForMode
in 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:
getGeneralisedCost
in interfaceCost<MacroscopicLinkSegment>
- Specified by:
getGeneralisedCost
in 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:
getSegmentCost
in 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:
setSegmentCost
in 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:
setSegmentCost
in 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:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in 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:
deepClone
in interfaceIdAble
- Specified by:
deepClone
in 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:
reset
in 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:
getTravelTimeCost
in 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:
getDTravelTimeDFlow
in 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:
collectSettingsAsKeyValueMap
in classPlanitComponent<InitialPhysicalCost>
- Returns:
- name-value map of all (user configurable) settings
-
-