Package org.goplanit.assignment.ltm.sltm
Class StaticLtmAssignmentStrategy
- java.lang.Object
-
- org.goplanit.assignment.ltm.sltm.StaticLtmAssignmentStrategy
-
- Direct Known Subclasses:
StaticLtmBushStrategyBase
,StaticLtmPathStrategy
public abstract class StaticLtmAssignmentStrategy extends Object
Base class for dealing with different assignment solution methods within sLTM. These solution methods differ regarding their approach to representing path choices, e.g. bush based, or path based.- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description StaticLtmAssignmentStrategy(IdGroupingToken idGroupingToken, long assignmentId, TransportModelNetwork transportModelNetwork, StaticLtmSettings settings, TrafficAssignmentComponentAccessee taComponents)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
createInitialSolution(double[] initialLinkSegmentCosts)
Create the initial solution to start the equilibration process withprotected abstract StaticLtmNetworkLoading
createNetworkLoading()
Factory method to create the desired network loadingprotected void
executeNetworkCostsUpdate(Mode theMode, boolean updateOnlyPotentiallyBlockingNodeCosts, double[] costsToUpdate)
Perform an update of the network wide costs where a partial update is applied in case only potentially blocking nodes are updated during the loadingprotected void
executeNetworkLoading()
Perform a network loading based on the current assignment stateprotected CentroidVertex
findCentroidVertex(OdZone zone)
map zone to centroid vertexprotected long
getAssignmentId()
Collect parent assignment idabstract String
getDescription()
Description of the chosen sLTM strategy for equilibrationprotected IdGroupingToken
getIdGroupingToken()
Token to useprotected MacroscopicNetwork
getInfrastructureNetwork()
The physical network usedprotected StaticLtmNetworkLoading
getLoading()
The network loading to applyprotected OdDemands
getOdDemands()
Get od demands usedprotected StaticLtmSettings
getSettings()
The settingsprotected <T> T
getTrafficAssignmentComponent(Class<T> taComponentClassKey)
collect a component based on its class component signature keyprotected TransportModelNetwork
getTransportNetwork()
The transport model network usedboolean
hasConverged(GapFunction gapFunction, int iterationIndex)
Verify if assignment has converged, which, means computing ths gap and determining if it has converged in this iteration in this default setupabstract boolean
performIteration(Mode theMode, double[] costsToUpdate, int iterationIndex)
Perform a single iteration where we perform a loading and then an equilibration step resulting in updated costsprotected void
setOdDemands(OdDemands odDemands)
set od demand usedvoid
updateTimePeriod(TimePeriod timePeriod, Mode mode, OdDemands odDemands)
Invoked before start of equilibrating a new time periodprotected void
verifyNetworkLoadingConvergenceProgress(StaticLtmNetworkLoading networkLoading, int networkLoadingIterationIndex)
Verify convergence progress and if insufficient attempt to activate one or more extensions to overcome convergence difficulties
-
-
-
Constructor Detail
-
StaticLtmAssignmentStrategy
public StaticLtmAssignmentStrategy(IdGroupingToken idGroupingToken, long assignmentId, TransportModelNetwork transportModelNetwork, StaticLtmSettings settings, TrafficAssignmentComponentAccessee taComponents)
Constructor- Parameters:
idGroupingToken
- to use for id generationassignmentId
- id of the parent assignmenttransportModelNetwork
- the transport model networksettings
- the sLTM settings to usetaComponents
- to use
-
-
Method Detail
-
getTransportNetwork
protected TransportModelNetwork getTransportNetwork()
The transport model network used- Returns:
- transport model network
-
getInfrastructureNetwork
protected MacroscopicNetwork getInfrastructureNetwork()
The physical network used- Returns:
- the infrastructure network
-
getIdGroupingToken
protected IdGroupingToken getIdGroupingToken()
Token to use- Returns:
- token
-
getAssignmentId
protected long getAssignmentId()
Collect parent assignment id- Returns:
- parent assignment id
-
getLoading
protected StaticLtmNetworkLoading getLoading()
The network loading to apply- Returns:
- network loading
-
getSettings
protected StaticLtmSettings getSettings()
The settings- Returns:
- settings
-
getOdDemands
protected OdDemands getOdDemands()
Get od demands used- Returns:
- odDemands used
-
setOdDemands
protected void setOdDemands(OdDemands odDemands)
set od demand used- Parameters:
odDemands
- to use
-
getTrafficAssignmentComponent
protected <T> T getTrafficAssignmentComponent(Class<T> taComponentClassKey)
collect a component based on its class component signature key- Type Parameters:
T
- key type of component- Parameters:
taComponentClassKey
- class of component- Returns:
- found component, if any
-
findCentroidVertex
protected CentroidVertex findCentroidVertex(OdZone zone)
map zone to centroid vertex- Parameters:
zone
- to map- Returns:
- vertex found
-
verifyNetworkLoadingConvergenceProgress
protected void verifyNetworkLoadingConvergenceProgress(StaticLtmNetworkLoading networkLoading, int networkLoadingIterationIndex)
Verify convergence progress and if insufficient attempt to activate one or more extensions to overcome convergence difficulties- Parameters:
networkLoading
- to verify progress onnetworkLoadingIterationIndex
- we are at
-
executeNetworkLoading
protected void executeNetworkLoading()
Perform a network loading based on the current assignment state
-
createNetworkLoading
protected abstract StaticLtmNetworkLoading createNetworkLoading()
Factory method to create the desired network loading- Returns:
- network loading for this solution approach
-
executeNetworkCostsUpdate
protected void executeNetworkCostsUpdate(Mode theMode, boolean updateOnlyPotentiallyBlockingNodeCosts, double[] costsToUpdate) throws PlanItException
Perform an update of the network wide costs where a partial update is applied in case only potentially blocking nodes are updated during the loading- Parameters:
theMode
- to perform the update forupdateOnlyPotentiallyBlockingNodeCosts
- flag indicating if only the costs of the entry link segments of potentially blocking nodes are to be updated, or all link segment costs are to be updatedcostsToUpdate
- the network wide costs to update (fully or partially), this is an output- Throws:
PlanItException
- thrown if error
-
updateTimePeriod
public void updateTimePeriod(TimePeriod timePeriod, Mode mode, OdDemands odDemands)
Invoked before start of equilibrating a new time period- Parameters:
timePeriod
- to initialise formode
- to initialise forodDemands
- to use
-
hasConverged
public boolean hasConverged(GapFunction gapFunction, int iterationIndex)
Verify if assignment has converged, which, means computing ths gap and determining if it has converged in this iteration in this default setup- Parameters:
gapFunction
- to useiterationIndex
- to use- Returns:
- true when considered converged, false otherwise
-
createInitialSolution
public abstract void createInitialSolution(double[] initialLinkSegmentCosts)
Create the initial solution to start the equilibration process with- Parameters:
initialLinkSegmentCosts
- to use
-
performIteration
public abstract boolean performIteration(Mode theMode, double[] costsToUpdate, int iterationIndex)
Perform a single iteration where we perform a loading and then an equilibration step resulting in updated costs- Parameters:
theMode
- to usecostsToUpdate
- the link segment costs we are updating (possibly partially for all link segments that might have been affected by a loadingiterationIndex
- we're at- Returns:
- true when iteration could be successfully completed, false otherwise
-
getDescription
public abstract String getDescription()
Description of the chosen sLTM strategy for equilibration- Returns:
- String
-
-