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 protected
InitialModesLinkSegmentCost()
Constructorprotected
InitialModesLinkSegmentCost(InitialModesLinkSegmentCost initialLinkSegmentCostMode)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InitialModesLinkSegmentCost
clone()
double
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.double
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 modevoid
reset()
Resetting initial cost will cause all intial costs to be removedvoid
setSegmentCost(Mode mode, long linkSegmentId, double cost)
Sets the initial cost for each link segment and modevoid
setSegmentCost(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:
getGeneralisedCost
in 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:
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
-
-