Class InitialModesLinkSegmentCost
- java.lang.Object
-
- org.goplanit.cost.physical.initial.InitialModesLinkSegmentCost
-
- All Implemented Interfaces:
Cloneable,Cost<MacroscopicLinkSegment>
public class InitialModesLinkSegmentCost extends Object implements Cloneable, Cost<MacroscopicLinkSegment>
Wrapper around all initial costs per link segment per mode. Used by InitialLinkSegmentCost to store costs per time period, or agnostic to a time period- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInitialModesLinkSegmentCost()ConstructorprotectedInitialModesLinkSegmentCost(InitialModesLinkSegmentCost initialLinkSegmentCostMode)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InitialModesLinkSegmentCostclone()doublegetDTravelTimeDFlow(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.doublegetTravelTimeCost(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 modevoidreset()Resetting initial cost will cause all intial costs to be removedvoidsetSegmentCost(Mode mode, long linkSegmentId, double cost)Sets the initial cost for each link segment and modevoidsetSegmentCost(Mode mode, MacroscopicLinkSegment linkSegment, double cost)Sets the initial cost for each link segment and mode
-
-
-
Constructor Detail
-
InitialModesLinkSegmentCost
protected InitialModesLinkSegmentCost()
Constructor
-
InitialModesLinkSegmentCost
protected InitialModesLinkSegmentCost(InitialModesLinkSegmentCost initialLinkSegmentCostMode)
Copy constructor- Parameters:
initialLinkSegmentCostMode- to copy
-
-
Method Detail
-
isSegmentCostsSetForMode
public boolean isSegmentCostsSetForMode(Mode mode)
Are link segment costs available for the given mode- Parameters:
mode- 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. When absent positive infinity is returned- Specified by:
getGeneralisedCostin interfaceCost<MacroscopicLinkSegment>- Parameters:
mode- 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)
Sets the initial cost for each link segment and mode- Parameters:
mode- the current modelinkSegment- the current link segmentcost- the initial cost for this link segment and mode
-
setSegmentCost
public void setSegmentCost(Mode mode, long linkSegmentId, double cost)
Sets the initial cost for each link segment and mode- Parameters:
mode- the current modelinkSegmentId- the id of the current link segmentcost- the initial cost for this link segment and mode At present this method is only used in unit tests.
-
clone
public InitialModesLinkSegmentCost clone()
-
reset
public void reset()
Resetting initial cost will cause all intial costs to be removed
-
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
-
-