Class StaticLtmNetworkLoading
- java.lang.Object
-
- org.goplanit.assignment.ltm.sltm.loading.StaticLtmNetworkLoading
-
- Direct Known Subclasses:
StaticLtmLoadingBushBase
,StaticLtmLoadingPath
public abstract class StaticLtmNetworkLoading extends Object
Class exposing the various sLTM network loading solution method components of sLTM (not considering path choice, this is assumed to be given). Network loading solution method Based on Raadsen and Bliemer (2021) General solution scheme for the Static Link Transmission Model .- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected StaticLtmNetworkLoadingConvergenceAnalyser
convergenceAnalyser
analyser to track if loading is converging as expected based on its settingsprotected NormBasedGapFunction
flowAcceptanceGapFunction
the gap function to apply on global convergence updateprotected InflowOutflowData
inFlowOutflowData
variables tracked for temporary inflow outflow tracking within sub algorithmsprotected NetworkLoadingFactorData
networkLoadingFactorData
tracks flow acceptance factors as well as its two related other factors, storage and capacity factorsprotected StaticLtmLoadingScheme
prevIterationFinalSolutionScheme
track the solution scheme applied before the currentprotected ReceivingFlowData
receivingFlowData
variables tracked for receiving flow update stepprotected NormBasedGapFunction
receivingFlowGapFunction
the gap function to apply on receiving flow update stepprotected SendingFlowData
sendingFlowData
variables tracked for sending flow update stepprotected NormBasedGapFunction
sendingFlowGapFunction
the gap function to apply on sending flow update stepprotected StaticLtmSettings
settings
user settings used regarding how to run the loadingprotected StaticLtmLoadingScheme
solutionScheme
track the approach of how the solution scheme is applied based on this typeprotected SplittingRateData
splittingRateData
variables tracked for splitting rate update step
-
Constructor Summary
Constructors Modifier Constructor Description protected
StaticLtmNetworkLoading(IdGroupingToken idToken, long runId, StaticLtmSettings settings)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
activateAllUsedNodeSplittingRates(double[] sendingFlowsPcuH)
For all nodes that have downstream link segments with positive sending flows, ensure they are activated for splitting rates (activation implies tracking and potentially blocking) if not already.protected abstract void
activateEligibleSplittingRateTrackedNodes()
Let derived loading implementation initialise which nodes are to be tracked for network splitting rates, e.g.boolean
activateNextExtension(boolean logRecentGaps)
Given the current extension status and type of sLTM that we are conducting, activate the next extension in loading to improve the likelihood of network loading convergence.StaticLtmLoadingScheme
getActivatedSolutionScheme()
Currently active sLTM solution schemedouble[]
getCurrentFlowAcceptanceFactors()
Access to most recent flow acceptance factors (alphas)double[]
getCurrentInflowsPcuH()
Collect the most recently calculate total inflows by the loadingdouble[]
getCurrentOutflowsPcuH()
Collect the most recently calculate total outflows by the loadingprotected OdDemands
getOdDemands()
access to od demands for loadingStaticLtmSettings
getSettings()
Collect the settings.SplittingRateData
getSplittingRateData()
Collect the network's current splitting rate dataMode
getSupportedMode()
The supported modes of this loadingprotected TransportModelNetwork
getTransportNetwork()
Get the transport model networkprotected MacroscopicNetworkLayer
getUsedNetworkLayer()
Convenience method to collect the used layer for this loadingvoid
initialiseInputs(Mode mode, OdDemands odDemands, TransportModelNetwork network)
Initialise the loading with the given inputsboolean
isConverging()
Verify if we are still convergingprotected boolean
isIterativeSendingFlowUpdateActivated()
Verify if the sending flows are updated iteratively and locally in the Step 2 sending flow update.protected boolean
isTrackAllNodeTurnFlows()
Verify if all turn flows are to be tracked during loading.protected abstract void
networkLoadingLinkSegmentSendingflowOutflowUpdate()
Conduct a network loading to compute updated current sending flow and outflow rates (without tracking turn flows).protected abstract void
networkLoadingLinkSegmentSendingFlowUpdate()
Conduct a network loading to compute updated current sending flow rates (without tracking turn flows): Eq.protected abstract org.apache.commons.collections4.map.MultiKeyMap<Object,Double>
networkLoadingTurnFlowUpdate()
Conduct a network loading to compute updated turn inflow rates u_ab: Eq.static void
performNodeModelUpdate(DirectedVertex node, ApplyToNodeModelResult consumer, StaticLtmNetworkLoading staticLtmNetworkLoading)
conduct a node model update sLTM style withvoid
reset()
Reset the network loadingvoid
resetIteration()
Reset the network loading for the next iterationboolean
stepFiveCheckNetworkLoadingConvergence(int networkLoadingIteration)
1.void
stepFourOutflowReceivingFlowUpdate()
1.void
stepOneSplittingRatesUpdate()
Perform splitting rate update (before sending flow update) of the network loading: 1.void
stepSixFinaliseForPersistence()
When loading has converged, outputs might be persisted for (intermediate) iterations.void
stepThreeSplittingRateUpdate()
Perform splitting rate update (before receiving flow update) of the network loading: 1.void
stepTwoInflowSendingFlowUpdate()
Perform splitting rate update (before sending flow update) of the network loading: 1.boolean
stepZeroIterationInitialisation(boolean logSolutionScheme)
Perform initialisation of the network loading.protected void
updatePotentiallyBlockingNodes(double[] sendingFlowsPcuH)
For all nodes that have downstream link segments with sending flows that exceed their capacity, ensure they are registered as potentially blocking (if not already)protected boolean
validateInputs()
Validate all constructor parameters
-
-
-
Field Detail
-
sendingFlowData
protected SendingFlowData sendingFlowData
variables tracked for sending flow update step
-
receivingFlowData
protected ReceivingFlowData receivingFlowData
variables tracked for receiving flow update step
-
splittingRateData
protected SplittingRateData splittingRateData
variables tracked for splitting rate update step
-
networkLoadingFactorData
protected NetworkLoadingFactorData networkLoadingFactorData
tracks flow acceptance factors as well as its two related other factors, storage and capacity factors
-
inFlowOutflowData
protected InflowOutflowData inFlowOutflowData
variables tracked for temporary inflow outflow tracking within sub algorithms
-
flowAcceptanceGapFunction
protected NormBasedGapFunction flowAcceptanceGapFunction
the gap function to apply on global convergence update
-
sendingFlowGapFunction
protected NormBasedGapFunction sendingFlowGapFunction
the gap function to apply on sending flow update step
-
receivingFlowGapFunction
protected NormBasedGapFunction receivingFlowGapFunction
the gap function to apply on receiving flow update step
-
settings
protected final StaticLtmSettings settings
user settings used regarding how to run the loading
-
convergenceAnalyser
protected final StaticLtmNetworkLoadingConvergenceAnalyser convergenceAnalyser
analyser to track if loading is converging as expected based on its settings
-
solutionScheme
protected StaticLtmLoadingScheme solutionScheme
track the approach of how the solution scheme is applied based on this type
-
prevIterationFinalSolutionScheme
protected StaticLtmLoadingScheme prevIterationFinalSolutionScheme
track the solution scheme applied before the current
-
-
Constructor Detail
-
StaticLtmNetworkLoading
protected StaticLtmNetworkLoading(IdGroupingToken idToken, long runId, StaticLtmSettings settings)
Constructor- Parameters:
idToken
- for id generation of internal entitiesrunId
- run id the loading is applied forsettings
- to use
-
-
Method Detail
-
validateInputs
protected boolean validateInputs()
Validate all constructor parameters- Returns:
- true when positively validated, false when failed
-
getUsedNetworkLayer
protected MacroscopicNetworkLayer getUsedNetworkLayer()
Convenience method to collect the used layer for this loading- Returns:
- layer used
-
getTransportNetwork
protected TransportModelNetwork getTransportNetwork()
Get the transport model network- Returns:
- transport model network
-
getOdDemands
protected OdDemands getOdDemands()
access to od demands for loading- Returns:
- odDemands
-
isIterativeSendingFlowUpdateActivated
protected boolean isIterativeSendingFlowUpdateActivated()
Verify if the sending flows are updated iteratively and locally in the Step 2 sending flow update. when not updated iteratively, only a single update is performed before doing another loading consistent with Bliemer et al. (2014). When updated iteratively, the solution scheme presented in Raadsen and Bliemer (2021) is active.- Returns:
- true when not in POINT_QUEUE_BASIC scheme, false otherwise
-
isTrackAllNodeTurnFlows
protected boolean isTrackAllNodeTurnFlows()
Verify if all turn flows are to be tracked during loading.- Returns:
- false when POINT_QUEUE_BASIC solution scheme is active, true otherwise
-
updatePotentiallyBlockingNodes
protected void updatePotentiallyBlockingNodes(double[] sendingFlowsPcuH)
For all nodes that have downstream link segments with sending flows that exceed their capacity, ensure they are registered as potentially blocking (if not already)- Parameters:
sendingFlowsPcuH
- to use
-
activateAllUsedNodeSplittingRates
protected void activateAllUsedNodeSplittingRates(double[] sendingFlowsPcuH)
For all nodes that have downstream link segments with positive sending flows, ensure they are activated for splitting rates (activation implies tracking and potentially blocking) if not already. To be used when we consider spillback or when we performing iterative local sending flow updates to propagate flows locally.- Parameters:
sendingFlowsPcuH
- to use
-
networkLoadingTurnFlowUpdate
protected abstract org.apache.commons.collections4.map.MultiKeyMap<Object,Double> networkLoadingTurnFlowUpdate()
Conduct a network loading to compute updated turn inflow rates u_ab: Eq. (3)-(4) in paper. We only consider turns on nodes that are tracked or activated to reduce computational overhead.- Returns:
- acceptedTurnFlows (on potentially blocking nodes) where multikey comprises entry and exit edge segment and value is the accepted turn flow v_ab
-
networkLoadingLinkSegmentSendingFlowUpdate
protected abstract void networkLoadingLinkSegmentSendingFlowUpdate()
Conduct a network loading to compute updated current sending flow rates (without tracking turn flows): Eq. (3)-(4) in paper
-
networkLoadingLinkSegmentSendingflowOutflowUpdate
protected abstract void networkLoadingLinkSegmentSendingflowOutflowUpdate()
Conduct a network loading to compute updated current sending flow and outflow rates (without tracking turn flows). Used to finalise a loading after convergence to ensure consistency in flows that might be compromised during local updates
-
activateEligibleSplittingRateTrackedNodes
protected abstract void activateEligibleSplittingRateTrackedNodes()
Let derived loading implementation initialise which nodes are to be tracked for network splitting rates, e.g. a bush-based implementation requires all nodes along PASs to be tracked (Regardless if they are potentially blocking), whereas a path based implementation only requires potentially blocking node to be tracked.
-
performNodeModelUpdate
public static void performNodeModelUpdate(DirectedVertex node, ApplyToNodeModelResult consumer, StaticLtmNetworkLoading staticLtmNetworkLoading)
conduct a node model update sLTM style with- Parameters:
node
- to computeconsumer
- to apply to the result of each node model update of the considered nodes, may be null then ignoredstaticLtmNetworkLoading
- sLTMloading containing the data to populate node with (using current sending flows)
-
initialiseInputs
public void initialiseInputs(Mode mode, OdDemands odDemands, TransportModelNetwork network)
Initialise the loading with the given inputs- Parameters:
mode
- to useodDemands
- to usenetwork
- to use
-
stepZeroIterationInitialisation
public boolean stepZeroIterationInitialisation(boolean logSolutionScheme)
Perform initialisation of the network loading. This method can only be called once. 1. Initial acceptance flow, capacity, and storage factors, all set to one 2. Initial in/outflows via network loading Eq. (3)-(4) in paper: unconstrained network loading 3. Initial sending and receiving flows: s_a=u_a, r_a=capacity_a for all link segments a 4. Set iteration number to one (to be done exogenously) (Extension A): 5. Restrict receiving flows to storage capacity Eq. (8) - only relevant when storage capacity is activated- Parameters:
logSolutionScheme
- flag indicating whether or not to log the solution scheme used- Returns:
- true when successful, false otherwise
-
stepOneSplittingRatesUpdate
public void stepOneSplittingRatesUpdate()
Perform splitting rate update (before sending flow update) of the network loading: 1. Update inflows via network loading Eq. (3) 2. Update splitting rates Eq. (6),(4) (Extension B) 3. If not first iteration then update splitting rates, Eq. (13)
-
stepTwoInflowSendingFlowUpdate
public void stepTwoInflowSendingFlowUpdate()
Perform splitting rate update (before sending flow update) of the network loading: 1. Update node model to compute new inflows, Eq. (5) 2. Update next sending flows via inflows, Eq. (7) 3. Compute gap, then update sending flows to next sending flows 4. If converged continue, otherwise continue go back to Step 2-(1). 5. Update storage capacity factors, Eq. (11) (Extension B) 6. Update smoothed storage capacity factors, Eq. (14)
-
stepThreeSplittingRateUpdate
public void stepThreeSplittingRateUpdate()
Perform splitting rate update (before receiving flow update) of the network loading: 1. Update intermediate flow acceptance factors, Eq. (9) 2. Update inflows via network loading, Eq. (3) 3. Update splitting rates, Eq. (6) (Extension B) 4. If not first iteration then update splitting rates, Eq. (13) (Extension C) 5. Estimate new multiplication factor used in Step 4, Eq. (16),(17)
-
stepFourOutflowReceivingFlowUpdate
public void stepFourOutflowReceivingFlowUpdate()
1. Update node model, to compute outflows Eq. (5) 2. Update receiving flows based on outflows, Eq. (8) (Extension B) 3. Transform to nudged receiving flows using multiplication factor, Eq. (18) (end Extension B) 4. Compute gap then set next receiving flows to current receiving flows 5. If converged continue, else go back to Step 4-(1). 6. Update flow capacity factors, Eq. (10) (Extension C) 7. Update smoothed flow capacity factors, Eq. (14)
-
stepFiveCheckNetworkLoadingConvergence
public boolean stepFiveCheckNetworkLoadingConvergence(int networkLoadingIteration)
1. Update flow acceptance factors, Eq. (9) 2. Compute gap using flow acceptance factors, 3. Increment iteration index, (to be done by caller) 4. If converged done, else go back to Step 1. (to be done by caller)- Parameters:
networkLoadingIteration
- at hand- Returns:
- true when converged, false otherwise
-
stepSixFinaliseForPersistence
public void stepSixFinaliseForPersistence()
When loading has converged, outputs might be persisted for (intermediate) iterations. Since the loading does not always track the entire network for performance reasons. This method can be invoked before persisting results to populate the gaps (if any) regarding for example link in and outflows that might otherwise not be available, e.g. in the POINT_QUEUE_BASIC laoding scheme only potentially blocking nodes and their immediate links might be tracked on the network level. Whereas if we want to see the results of this iteration, we would want the full inflows/outflows on all links in the network. This is what this methods ensure with minimal overhead.This is potentially costly, so ideally no intermediate results are persisted in such cases.
-
isConverging
public boolean isConverging()
Verify if we are still converging- Returns:
- true when potentially still converging, false otherwise
-
activateNextExtension
public boolean activateNextExtension(boolean logRecentGaps)
Given the current extension status and type of sLTM that we are conducting, activate the next extension in loading to improve the likelihood of network loading convergence. Each additional extension that is activated will slow down convergence,, so only do this when it is clear the current scheme does not suffice- Parameters:
logRecentGaps
- when true log all gaps in the period the most recent solution scheme method was active, when false do not- Returns:
- true when scheme changed, false if no longer possible to change any further
-
getSettings
public StaticLtmSettings getSettings()
Collect the settings. Only make changes before running any of the loading steps, otherwise risk undefined behaviour by the loading.- Returns:
- settings of this loading
-
getSupportedMode
public Mode getSupportedMode()
The supported modes of this loading- Returns:
- supported modes
-
getCurrentInflowsPcuH
public double[] getCurrentInflowsPcuH()
Collect the most recently calculate total inflows by the loading- Returns:
- inflows in Pcu per hour
-
getCurrentOutflowsPcuH
public double[] getCurrentOutflowsPcuH()
Collect the most recently calculate total outflows by the loading- Returns:
- outflows in Pcu per hour
-
reset
public void reset()
Reset the network loading
-
resetIteration
public void resetIteration()
Reset the network loading for the next iteration
-
getCurrentFlowAcceptanceFactors
public final double[] getCurrentFlowAcceptanceFactors()
Access to most recent flow acceptance factors (alphas)- Returns:
- flow acceptance factors
-
getSplittingRateData
public final SplittingRateData getSplittingRateData()
Collect the network's current splitting rate data- Returns:
- splitting rate data
-
getActivatedSolutionScheme
public StaticLtmLoadingScheme getActivatedSolutionScheme()
Currently active sLTM solution scheme- Returns:
- active solution scheme
-
-