Package org.goplanit.assignment.ltm.sltm
Class PasFlowShiftExecutor
- java.lang.Object
-
- org.goplanit.assignment.ltm.sltm.PasFlowShiftExecutor
-
- Direct Known Subclasses:
PasFlowShiftDestinationBasedExecutor
,PasFlowShiftOriginBasedDestLabelledExecutor
,PasFlowShiftOriginBasedSmartLabelledExecutor
public abstract class PasFlowShiftExecutor extends Object
Common functionality to conduct a PAS flow shift.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<RootedLabelledBush,Map<EdgeSegment,Pair<Double,Double>>>
bushEntrySegmentS1S2SendingFlows
Track the desired sending flows for s1 and s2 per bush per entry segmentprotected static double
EPSILON
local epsilon used in flow shiftingprotected Pas
pas
to operate onprotected static double
PAS_MIN_S2_FLOW_THRESHOLD
whenever a PAS S2 alternative's flow drops below this threshold for a given bush, we allow the flow shift to move all remaining flow towards the S1 segment across all entry segments and unregister the bush for this PAS as it is no longer deemed a true alternative.protected int
pasMergeVertexNumExitSegments
store locally as it is costly-ish to computeprotected StaticLtmSettings
settings
settings to useprotected Map<EdgeSegment,Pair<Double,Double>>
totalEntrySegmentS1S2Flow
S1 and S2 sending flows along (entire) alternative for a given entry segmentprotected Set<EdgeSegment>
usedCongestedEntryEdgeSegments
-
Constructor Summary
Constructors Modifier Constructor Description protected
PasFlowShiftExecutor(Pas pas, StaticLtmSettings settings)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
activatePasS2RemovalIf(boolean flag)
activate if flag is trueprotected double
determineEntrySegmentFlowShift(EdgeSegment entrySegment, Mode theMode, AbstractPhysicalCost physicalCost, AbstractVirtualCost virtualCost, StaticLtmLoadingBushBase<?> networkLoading)
For the given PAS-entrysegment determine the flow shift to apply from the high cost to the low cost segment.protected abstract void
executeBushFlowShift(RootedLabelledBush bush, EdgeSegment entrySegment, double bushEntrySegmentFlowShift, double[] flowAcceptanceFactors)
Perform the flow shift for a given bush.double
getS1SendingFlow()
Sending flow along PAS low cost segmentdouble
getS2SendingFlow()
Sending flow along PAS high cost segmentSet<EdgeSegment>
getUsedCongestedEntrySegments()
All used entry Segments that were found to be congested and a flow shift has been applied tovoid
initialise()
Initialise by determining the desired flows along each subpath (on the network level)protected boolean
isPasS2RemovalAllowed()
boolean
isTowardsEqualAlternativeFlowDistribution()
Check to see if last call todetermineEntrySegmentFlowShift(EdgeSegment, Mode, AbstractPhysicalCost, AbstractVirtualCost, StaticLtmLoadingBushBase)
caused a flow shift not trying to equate cost but equate flows given equal costboolean
run(Mode theMode, AbstractPhysicalCost physicalCost, AbstractVirtualCost virtualCost, StaticLtmLoadingBushBase<?> networkLoading, double factor)
We account for the fact that per bush different incoming links to the PAS might be used so each incoming link that is used and that is congested should be the basis for the flow shift instead of the first congested one within the PAS.
-
-
-
Field Detail
-
EPSILON
protected static final double EPSILON
local epsilon used in flow shifting- See Also:
- Constant Field Values
-
PAS_MIN_S2_FLOW_THRESHOLD
protected static final double PAS_MIN_S2_FLOW_THRESHOLD
whenever a PAS S2 alternative's flow drops below this threshold for a given bush, we allow the flow shift to move all remaining flow towards the S1 segment across all entry segments and unregister the bush for this PAS as it is no longer deemed a true alternative.- See Also:
- Constant Field Values
-
pas
protected final Pas pas
to operate on
-
settings
protected final StaticLtmSettings settings
settings to use
-
totalEntrySegmentS1S2Flow
protected Map<EdgeSegment,Pair<Double,Double>> totalEntrySegmentS1S2Flow
S1 and S2 sending flows along (entire) alternative for a given entry segment
-
bushEntrySegmentS1S2SendingFlows
protected final Map<RootedLabelledBush,Map<EdgeSegment,Pair<Double,Double>>> bushEntrySegmentS1S2SendingFlows
Track the desired sending flows for s1 and s2 per bush per entry segment
-
usedCongestedEntryEdgeSegments
protected final Set<EdgeSegment> usedCongestedEntryEdgeSegments
-
pasMergeVertexNumExitSegments
protected final int pasMergeVertexNumExitSegments
store locally as it is costly-ish to compute
-
-
Constructor Detail
-
PasFlowShiftExecutor
protected PasFlowShiftExecutor(Pas pas, StaticLtmSettings settings)
Constructor- Parameters:
pas
- to usesettings
- to use
-
-
Method Detail
-
activatePasS2RemovalIf
protected void activatePasS2RemovalIf(boolean flag)
activate if flag is true- Parameters:
flag
- to determine whether or not to activate
-
isPasS2RemovalAllowed
protected boolean isPasS2RemovalAllowed()
-
executeBushFlowShift
protected abstract void executeBushFlowShift(RootedLabelledBush bush, EdgeSegment entrySegment, double bushEntrySegmentFlowShift, double[] flowAcceptanceFactors)
Perform the flow shift for a given bush. Delegate to concrete class implementation- Parameters:
bush
- to perform shift forentrySegment
- entry segment at hand to apply flow shift forbushEntrySegmentFlowShift
- the absolute shift to apply for the given PAS-bush-entrysegment combinationflowAcceptanceFactors
- to use
-
determineEntrySegmentFlowShift
protected double determineEntrySegmentFlowShift(EdgeSegment entrySegment, Mode theMode, AbstractPhysicalCost physicalCost, AbstractVirtualCost virtualCost, StaticLtmLoadingBushBase<?> networkLoading)
For the given PAS-entrysegment determine the flow shift to apply from the high cost to the low cost segment. Depending on the state of the segments we utilise their derivatives of travel time towards flow to determine the optimal shift. In case one or both segments are uncongested, or the congestion occurs on the entry segment while the cost on the PAS is already equal, we propose to shift as much flow as would yield an equal distribution between the alternatives (maximising entropy) in order to obtain a unique solution under equal cost. would expect the segment to transition to congestion.- Parameters:
entrySegment
- to usetheMode
- to usephysicalCost
- to usevirtualCost
- to usenetworkLoading
- to use- Returns:
- amount of flow to shift
-
initialise
public void initialise()
Initialise by determining the desired flows along each subpath (on the network level)
-
run
public boolean run(Mode theMode, AbstractPhysicalCost physicalCost, AbstractVirtualCost virtualCost, StaticLtmLoadingBushBase<?> networkLoading, double factor)
We account for the fact that per bush different incoming links to the PAS might be used so each incoming link that is used and that is congested should be the basis for the flow shift instead of the first congested one within the PAS. This is currently not accounted for + if an incoming link is congested, then it has the same alpha for both alternatives BUT the most restricting one might be linked to one of those. If so then we should shift towards the other! This does not exist yet. If neither is the most restricting then revert to situation where we shift as if uncongested as it has no impact. So, split flow shift and execution to per incoming link rather than combining them as we do in run!! Later we can optimise possibly Each PAS per bush is split in x PASs where x is the number of used in links for each bush- Parameters:
theMode
- to usephysicalCost
- to usevirtualCost
- to usenetworkLoading
- to usefactor
- to apply to flow shift- Returns:
- true when flow is shifted, false otherwise
-
getS2SendingFlow
public double getS2SendingFlow()
Sending flow along PAS high cost segment- Returns:
- high cost alternative desired flow
-
getS1SendingFlow
public double getS1SendingFlow()
Sending flow along PAS low cost segment- Returns:
- low cost alternative desired flow
-
isTowardsEqualAlternativeFlowDistribution
public boolean isTowardsEqualAlternativeFlowDistribution()
Check to see if last call todetermineEntrySegmentFlowShift(EdgeSegment, Mode, AbstractPhysicalCost, AbstractVirtualCost, StaticLtmLoadingBushBase)
caused a flow shift not trying to equate cost but equate flows given equal cost- Returns:
- true when attempting to move to equal distribution of flow across alternatives, false otherwise
-
getUsedCongestedEntrySegments
public Set<EdgeSegment> getUsedCongestedEntrySegments()
All used entry Segments that were found to be congested and a flow shift has been applied to- Returns:
- set of found edge segments
-
-