Class TampereNodeModel
- java.lang.Object
-
- org.goplanit.algorithms.nodemodel.TampereNodeModel
-
- All Implemented Interfaces:
NodeModel
public class TampereNodeModel extends Object implements NodeModel
General First order node model implementation as proposed by Tampere et al. (2011). Here we utilise the algorithm description as presented in Bliemer et al. (2014). Each run of this node model requires two inputs, the mapping of the network to the local node and the Paper References:- Tampère, C. M. J., Corthout, R., Cattrysse, D., & Immers, L. H. (2011). A generic class of first order node models for dynamic macroscopic simulation of traffic flows. Transportation Research Part B: Methodological, 45(1), 289–309. https://doi.org/10.1016/j.trb.2010.06.004
- Bliemer, M. C. J., Raadsen, M. P. H., Smits, E.-S., Zhou, B., & Bell, M. G. H. (2014). Quasi-dynamic traffic assignment with residual point queues incorporating a first order node model. Transportation Research Part B: Methodological, 68, 363–384. https://doi.org/10.1016/j.trb.2014.07.001
- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected org.ojalgo.array.Array1D<Double>
incomingLinkSegmentFlowAcceptanceFactors
the result of the node model are the acceptance factors for each incoming link segmentprotected TampereNodeModelInput
inputs
inputs for this node model instanceprotected boolean[]
processedInLinkSegments
track which in-link segments are processed X_topbar.protected org.ojalgo.array.Array1D<Double>
remainingReceivingFlows
store the remaining receiving flows of each outgoing link segmentprotected org.ojalgo.array.Array2D<Double>
scaledRemainingTurnSendingFlows
store the remaining turn sending flows
-
Constructor Summary
Constructors Constructor Description TampereNodeModel(TampereNodeModelInput tampereNodeModelInput)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Pair<Double,Integer>
findMostRestrictingOutLinkSegmentIndex()
Find most restricted unprocessed outgoing link segment based on the scaled sending flowsTampereNodeModelInput
getInputs()
Provide access to the inputs usedMap<Integer,Integer>
getMostRestrictedOutLinkByInLink()
collect most restricted out link index by in link index.protected void
initialiseRun()
Initialise the run conforming to Step 1 in Appendix A of Bliemer et al.protected boolean
isInLinkSegmentProcessed(int inLinkSegmentIndex)
Verify if in-link segment has been processed already or notorg.ojalgo.array.Array1D<Double>
run()
Run the Tampere node modelprotected void
setInLinkSegmentProcessed(int inLinkSegmentIndex)
Mark in-link segment as processedprotected void
updateCapacityConstrainedInLinkSegments(Pair<Double,Integer> mostRestrictingOutLinkSegmentData)
Based on the most restricting out-link segment, determine the flow acceptance factor for all unprocessed in-link with non-zero (remaining) flows towards this out-link segmentprotected boolean
updateDemandConstrainedInLinkSegments(Pair<Double,Integer> mostRestrictingOutLinkSegmentData)
protected void
updateRemainingReceivingAndSendingFlows(long inLinkSegmentIndex)
Remove all turn sending flows from provided in-link from remaining receiving flows (whichever out-link they go to) for a demand constrained in link R_b' = R_b'-t_ab' for all out links b' t_ab' = 0 (to ensure the turn flows are not accidentally reused when updating lambda in next iteration)protected void
updateRemainingReceivingAndSendingFlows(long inLinkSegmentIndex, double flowAcceptanceFactor)
Remove all accepted turn sending flows (by scaling with flow acceptance factor) from provided in-link from remaining receiving flows (whichever out-link they go to) R_b' = R_b'-alpha_a*t_ab' for all out links b' t_ab' = 0 (to ensure the turn flows are not accidentally reused when updating lambda in next iteration)protected void
updateSets(Pair<Double,Integer> mostRestrictingOutLinkSegmentData)
Based on the outlink segment, we determine which in links are demand constrained (if any).
-
-
-
Field Detail
-
inputs
protected final TampereNodeModelInput inputs
inputs for this node model instance
-
remainingReceivingFlows
protected org.ojalgo.array.Array1D<Double> remainingReceivingFlows
store the remaining receiving flows of each outgoing link segment
-
scaledRemainingTurnSendingFlows
protected org.ojalgo.array.Array2D<Double> scaledRemainingTurnSendingFlows
store the remaining turn sending flows
-
processedInLinkSegments
protected boolean[] processedInLinkSegments
track which in-link segments are processed X_topbar. Note this is the inverse since it tracks processed rather than unprocessed link segments
-
incomingLinkSegmentFlowAcceptanceFactors
protected org.ojalgo.array.Array1D<Double> incomingLinkSegmentFlowAcceptanceFactors
the result of the node model are the acceptance factors for each incoming link segment
-
-
Constructor Detail
-
TampereNodeModel
public TampereNodeModel(TampereNodeModelInput tampereNodeModelInput) throws PlanItException
Constructor- Parameters:
tampereNodeModelInput
- inputs for the model- Throws:
PlanItException
- thrown if error
-
-
Method Detail
-
initialiseRun
protected void initialiseRun() throws PlanItException
Initialise the run conforming to Step 1 in Appendix A of Bliemer et al. 2014- Throws:
PlanItException
- thrown if error
-
findMostRestrictingOutLinkSegmentIndex
protected Pair<Double,Integer> findMostRestrictingOutLinkSegmentIndex()
Find most restricted unprocessed outgoing link segment based on the scaled sending flows- Returns:
- a pair of the restriction factor and outlinkSegmentIndex for the most restricted out link segment, null if no such out link could be found
-
updateSets
protected void updateSets(Pair<Double,Integer> mostRestrictingOutLinkSegmentData)
Based on the outlink segment, we determine which in links are demand constrained (if any). If there is one ore more, those are removed from the remaining unprocessed links and there sending flow is accepted as is. If not, then they are marked as capacity constrained and their sending flow must be reduced.- Parameters:
mostRestrictingOutLinkSegmentData
- out-link segment restriction factor and index
-
updateDemandConstrainedInLinkSegments
protected boolean updateDemandConstrainedInLinkSegments(Pair<Double,Integer> mostRestrictingOutLinkSegmentData)
- Parameters:
mostRestrictingOutLinkSegmentData
- with<beta_b, b>
with the former representing the outgoing link segment restriction factor, and the latter the index of b- Returns:
- true if demand constrained in link(s) is/are found, false otherwise
-
updateCapacityConstrainedInLinkSegments
protected void updateCapacityConstrainedInLinkSegments(Pair<Double,Integer> mostRestrictingOutLinkSegmentData)
Based on the most restricting out-link segment, determine the flow acceptance factor for all unprocessed in-link with non-zero (remaining) flows towards this out-link segment- Parameters:
mostRestrictingOutLinkSegmentData
- out-link segment restriction factor and index
-
updateRemainingReceivingAndSendingFlows
protected void updateRemainingReceivingAndSendingFlows(long inLinkSegmentIndex)
Remove all turn sending flows from provided in-link from remaining receiving flows (whichever out-link they go to) for a demand constrained in link R_b' = R_b'-t_ab' for all out links b' t_ab' = 0 (to ensure the turn flows are not accidentally reused when updating lambda in next iteration)- Parameters:
inLinkSegmentIndex
- the inLink to base the reduction on
-
updateRemainingReceivingAndSendingFlows
protected void updateRemainingReceivingAndSendingFlows(long inLinkSegmentIndex, double flowAcceptanceFactor)
Remove all accepted turn sending flows (by scaling with flow acceptance factor) from provided in-link from remaining receiving flows (whichever out-link they go to) R_b' = R_b'-alpha_a*t_ab' for all out links b' t_ab' = 0 (to ensure the turn flows are not accidentally reused when updating lambda in next iteration)- Parameters:
inLinkSegmentIndex
- the inLink to base the reduction onflowAcceptanceFactor
- to scale the sending flows to accepted flow
-
isInLinkSegmentProcessed
protected boolean isInLinkSegmentProcessed(int inLinkSegmentIndex)
Verify if in-link segment has been processed already or not- Parameters:
inLinkSegmentIndex
- the in link segment index- Returns:
- true if processed, false otherwise
-
setInLinkSegmentProcessed
protected void setInLinkSegmentProcessed(int inLinkSegmentIndex)
Mark in-link segment as processed- Parameters:
inLinkSegmentIndex
- to mark as processed
-
run
public org.ojalgo.array.Array1D<Double> run() throws PlanItException
Run the Tampere node model- Returns:
- flowAcceptanceFactor per incoming linksegment index
- Throws:
PlanItException
- thrown if error
-
getInputs
public TampereNodeModelInput getInputs()
Provide access to the inputs used- Returns:
- inputs used
-
getMostRestrictedOutLinkByInLink
public Map<Integer,Integer> getMostRestrictedOutLinkByInLink()
collect most restricted out link index by in link index. Only available after run and only for capacity constrained in links entries exist- Returns:
- map result, empty if no capacity constrained in links were found
-
-