Package org.goplanit.cost.virtual
Class FixedConnectoidTravelTimeCost
- java.lang.Object
-
- org.goplanit.component.PlanitComponent<AbstractVirtualCost>
-
- org.goplanit.cost.virtual.AbstractVirtualCost
-
- org.goplanit.cost.virtual.FixedConnectoidTravelTimeCost
-
- All Implemented Interfaces:
Serializable,Comparable<IdAble>,EventListener,PlanitComponentListener,Cost<ConnectoidSegment>,VirtualCost,EventListener,ExternalIdAble,IdAble
public class FixedConnectoidTravelTimeCost extends AbstractVirtualCost
Class holding fixed connectoid costs for each connectoid segment- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_FIXED_COSTDefault fixed costprotected doublefixedConnectoidCostFixed connectoid cost for connectoid segments-
Fields inherited from interface org.goplanit.cost.virtual.VirtualCost
FIXED, SPEED
-
-
Constructor Summary
Constructors Constructor Description FixedConnectoidTravelTimeCost(FixedConnectoidTravelTimeCost other, boolean deepCopy)Copy ConstructorFixedConnectoidTravelTimeCost(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 entityFixedConnectoidTravelTimeCostdeepClone()deep clone on planit component should attempt to also update internal dependencies between deep cloned containers where possibledoublegetDTravelTimeDFlow(boolean uncongested, Mode mode, ConnectoidSegment connectoidSegment)fixed cost so derivative is always zerodoublegetGeneralisedCost(Mode mode, ConnectoidSegment connectoidSegment)Returns the generalised cost of travel along an edge segment for a specified modedoublegetTravelTimeCost(Mode mode, ConnectoidSegment connectoidSegment)Returns the generalised cost of travel along an edge segment for a specified modevoidinitialiseBeforeSimulation(VirtualNetwork virtualNetwork)Initialize the virtual cost componentvoidpopulateWithCost(VirtualNetwork virtualNetwork, Mode mode, double[] costToFill)Invoker expects (mode specific ) costs in passed in array to be filled, where each entry signifies a link segment by its idvoidreset()Chosen cost is considered configuration not internal state, so upon resetting the chosen cost remains in tactvoidsetFixedConnectoidCost(double fixedConnectoidCost)set the fixed cost used for all relevant link segmentsFixedConnectoidTravelTimeCostshallowClone()Create a shallow copy of this entityvoidupdateTimePeriod(TimePeriod timePeriod)Provide the cost calculation with information regarding the time period for which the cost is to be calculated-
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
-
fixedConnectoidCost
protected double fixedConnectoidCost
Fixed connectoid cost for connectoid segments
-
DEFAULT_FIXED_COST
public static final double DEFAULT_FIXED_COST
Default fixed cost- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FixedConnectoidTravelTimeCost
public FixedConnectoidTravelTimeCost(IdGroupingToken groupId)
Constructor- Parameters:
groupId- contiguous id generation within this group for instances of this class
-
FixedConnectoidTravelTimeCost
public FixedConnectoidTravelTimeCost(FixedConnectoidTravelTimeCost other, boolean deepCopy)
Copy Constructor- Parameters:
other- to copydeepCopy- when true, create a deep copy, shallow copy otherwise
-
-
Method Detail
-
setFixedConnectoidCost
public void setFixedConnectoidCost(double fixedConnectoidCost)
set the fixed cost used for all relevant link segments- Parameters:
fixedConnectoidCost- the fixed cost to use
-
initialiseBeforeSimulation
public void initialiseBeforeSimulation(VirtualNetwork virtualNetwork) throws PlanItException
Initialize the virtual cost component- Specified by:
initialiseBeforeSimulationin classAbstractVirtualCost- Parameters:
virtualNetwork- the virtual network- Throws:
PlanItException- thrown if a link/mode combination exists for which no cost parameters have been set
-
updateTimePeriod
public void updateTimePeriod(TimePeriod timePeriod)
Provide the cost calculation with information regarding the time period for which the cost is to be calculated- Specified by:
updateTimePeriodin classAbstractVirtualCost- Parameters:
timePeriod- to apply
-
getGeneralisedCost
public double getGeneralisedCost(Mode mode, ConnectoidSegment connectoidSegment)
Returns the generalised cost of travel along an edge segment for a specified mode- Parameters:
mode- the specified mode of travelconnectoidSegment- the specified edge segment (which can be physical or virtual)- Returns:
- the cost of travel along the specified segment
-
populateWithCost
public void populateWithCost(VirtualNetwork virtualNetwork, Mode mode, double[] costToFill)
Invoker expects (mode specific ) costs in passed in array to be filled, where each entry signifies a link segment by its id- Parameters:
virtualNetwork- the cost pertains tomode- the mode these costs pertain tocostToFill- array of link segment costs identified by the link segment's internal id
-
shallowClone
public FixedConnectoidTravelTimeCost shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClonein interfaceIdAble- Specified by:
shallowClonein classPlanitComponent<AbstractVirtualCost>- Returns:
- shallow copy of entity
-
deepClone
public FixedConnectoidTravelTimeCost 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 classPlanitComponent<AbstractVirtualCost>- Returns:
- deep copy of entity
-
reset
public void reset()
Chosen cost is considered configuration not internal state, so upon resetting the chosen cost remains in tact- Specified by:
resetin classPlanitComponent<AbstractVirtualCost>
-
getTravelTimeCost
public double getTravelTimeCost(Mode mode, ConnectoidSegment connectoidSegment)
Returns the generalised cost of travel along an edge segment for a specified mode- Parameters:
mode- the specified mode of travelconnectoidSegment- 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, ConnectoidSegment connectoidSegment)fixed cost so derivative is always zero- Parameters:
uncongested- flag idicating if the provided flow is uncongested or congested flow, relevant when flow can represent multiple traffic statesmode- to useconnectoidSegment- 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<AbstractVirtualCost>- Returns:
- name-value map of all (user configurable) settings
-
-