Package org.planit.assignment
Class TrafficAssignment
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.planit.assignment.TrafficAssignmentComponent<NetworkLoading>
-
- org.planit.supply.networkloading.NetworkLoading
-
- org.planit.assignment.TrafficAssignment
-
- All Implemented Interfaces:
Serializable,Comparable<Idable>,org.djutils.event.EventProducerInterface,Idable
- Direct Known Subclasses:
CapacityConstrainedAssignment,StaticTrafficAssignment
public abstract class TrafficAssignment extends NetworkLoading
Traffic assignment class which simultaneously is responsible for the loading hence it is also considered as a traffic assignment component of this type- Author:
- markr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringALGORITHM_Bshort hand to choose algorithmB as assignment typeprotected DemandsdemandsThe demand to usestatic StringELTMshort hand to choose eLTM as assignment typeprotected InitialLinkSegmentCostinitialLinkSegmentCostThe initial link segment costprotected Map<TimePeriod,InitialLinkSegmentCost>initialLinkSegmentCostByTimePeriodMap storing InitialLinkSegmentCost objects for each time periodprotected intnumberOfNetworkSegmentsholds the count of all link segments in the transport networkprotected intnumberOfNetworkVerticesholds the count of all vertices in the transport networkprotected AbstractPhysicalCostphysicalCostThe physical generalized cost approachprotected Smoothingsmoothingthe smoothing to usestatic StringTRADITIONAL_STATIC_ASSIGNMENTshort hand to choose traditional static assignment as assignment typeprotected TransportNetworktransportNetworkThe transport network to use which is an adaptor around the physical network and the zoningprotected AbstractVirtualCostvirtualCostThe virtual cost function-
Fields inherited from class org.planit.assignment.TrafficAssignmentComponent
id, tokenId, trafficComponentType
-
-
Constructor Summary
Constructors Constructor Description TrafficAssignment(IdGroupingToken groupId)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckForEmptyComponents()Check if any components are undefined, if so throw exceptionprotected StringcreateLoggingPrefix(int iterationIndex)create the logging prefix for logging statements during equilibrationabstract OutputTypeAdaptercreateOutputTypeAdapter(OutputType outputType)Create the output type adapter for the current output type, specifically tailored towards the assignment type that we are builingprotected voidcreateTransportNetwork()Initialize the transport network by combining the physical and virtual componentsprotected voiddisbandTransportNetwork()detach the virtual and physical transport network againvoidexecute()Execute assignment, including initializing resources, running equilibration and then closing resourcesabstract voidexecuteEquilibration()Run equilibration after resources initialized, including saving resultsprotected voidfinalizeAfterExecution()Finalize all relevant traffic assignment components after execution of the assignment has endedGapFunctiongetGapFunction()Collect the gap function which is to be set by a derived class of TrafficAssignment via the initialiseDefaults() right after constructionabstract intgetIterationIndex()Collect the current iteration index of the simulationprotected OutputManagergetOutputManager()Collect the output managerAbstractPhysicalCostgetPhysicalCost()Get the dynamic physical cost object for the current assignmentSmoothinggetSmoothing()Collect the smoothing object for the current traffic assignmentTransportNetworkgetTransportNetwork()Get the TransportNetwork used in the current assignmentAbstractVirtualCostgetVirtualCost()Returns the virtual cost object for the current assignmentprotected voidinitialiseBeforeExecution()Initialize all relevant traffic assignment components before execution of the assignment commencesvoidsetDemands(Demands demands)Set the Demands object for the current assignmentvoidsetGapFunction(GapFunction gapfunction)Collect the gap function which is to be set by a derived class of TrafficAssignment via the initialiseDefaults() right after constructionvoidsetInfrastructureNetwork(InfrastructureNetwork network)Set the network for the current assignmentvoidsetInitialLinkSegmentCost(InitialLinkSegmentCost initialLinkSegmentCost)Set the initial link segment cost unrelated to any particular time period, i.e., used for all time periods that do not have designated initial costs specified for themvoidsetInitialLinkSegmentCost(TimePeriod timePeriod, InitialLinkSegmentCost initialLinkSegmentCost)Set the initial link segment cost for a specified time period, otherwise revert to the general initial link segment cost (if any)voidsetOutputManager(OutputManager outputManager)Set the output manager which holds all the configuration options regarding this assignmentvoidsetPhysicalCost(AbstractPhysicalCost physicalCost)Set the physical cost where in case the cost is an InteractorAccessor will trigger an event to get access to the required data via requesting an InteractorAccesseevoidsetSmoothing(Smoothing smoothing)Set the Smoothing object for the current assignmentvoidsetVirtualCost(AbstractVirtualCost virtualCost)Set the virtual cost where in case the cost is an InteractorAccessor will trigger an event to get access to the required data via requesting an InteractorAccesseevoidsetZoning(Zoning zoning)Set the zoning object for the current assignmentprotected voidverifyComponentCompatibility()Verify if the traffic assignment components are compatible and nonnull-
Methods inherited from class org.planit.assignment.TrafficAssignmentComponent
equals, getId, getIdGroupingToken, getSourceId, getTrafficComponentType, hashCode
-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.planit.utils.id.Idable
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
transportNetwork
protected TransportNetwork transportNetwork
The transport network to use which is an adaptor around the physical network and the zoning
-
virtualCost
protected AbstractVirtualCost virtualCost
The virtual cost function
-
numberOfNetworkSegments
protected int numberOfNetworkSegments
holds the count of all link segments in the transport network
-
numberOfNetworkVertices
protected int numberOfNetworkVertices
holds the count of all vertices in the transport network
-
smoothing
protected Smoothing smoothing
the smoothing to use
-
demands
protected Demands demands
The demand to use
-
initialLinkSegmentCost
protected InitialLinkSegmentCost initialLinkSegmentCost
The initial link segment cost
-
physicalCost
protected AbstractPhysicalCost physicalCost
The physical generalized cost approach
-
initialLinkSegmentCostByTimePeriod
protected Map<TimePeriod,InitialLinkSegmentCost> initialLinkSegmentCostByTimePeriod
Map storing InitialLinkSegmentCost objects for each time period
-
TRADITIONAL_STATIC_ASSIGNMENT
public static String TRADITIONAL_STATIC_ASSIGNMENT
short hand to choose traditional static assignment as assignment type
-
ALGORITHM_B
public static String ALGORITHM_B
short hand to choose algorithmB as assignment type
-
ELTM
public static String ELTM
short hand to choose eLTM as assignment type
-
-
Constructor Detail
-
TrafficAssignment
public TrafficAssignment(IdGroupingToken groupId)
Constructor. Note that defaults that partly depend on derived classes are assumed to be invoked by the calling method via this.initialiseDefaults()- Parameters:
groupId- contiguous id generation within this group for instances of this class
-
-
Method Detail
-
createLoggingPrefix
protected String createLoggingPrefix(int iterationIndex)
create the logging prefix for logging statements during equilibration- Parameters:
iterationIndex- the iteration- Returns:
- prefix for logging of traffic assignment messages
-
checkForEmptyComponents
protected void checkForEmptyComponents() throws PlanItExceptionCheck if any components are undefined, if so throw exception- Throws:
PlanItException- thrown if any components are undefined
-
verifyComponentCompatibility
protected void verifyComponentCompatibility() throws PlanItExceptionVerify if the traffic assignment components are compatible and nonnull- Throws:
PlanItException- thrown if the components are not compatible
-
createTransportNetwork
protected void createTransportNetwork() throws PlanItExceptionInitialize the transport network by combining the physical and virtual components- Throws:
PlanItException- thrown if there is an error
-
disbandTransportNetwork
protected void disbandTransportNetwork() throws PlanItExceptiondetach the virtual and physical transport network again- Throws:
PlanItException- thrown if there is an error
-
initialiseBeforeExecution
protected void initialiseBeforeExecution() throws PlanItExceptionInitialize all relevant traffic assignment components before execution of the assignment commences- Throws:
PlanItException- thrown if there is an error
-
finalizeAfterExecution
protected void finalizeAfterExecution() throws PlanItExceptionFinalize all relevant traffic assignment components after execution of the assignment has ended- Throws:
PlanItException- thrown if there is an error
-
getOutputManager
protected OutputManager getOutputManager()
Collect the output manager- Returns:
- output manager for this assignment
-
createOutputTypeAdapter
public abstract OutputTypeAdapter createOutputTypeAdapter(OutputType outputType)
Create the output type adapter for the current output type, specifically tailored towards the assignment type that we are builing- Parameters:
outputType- the current output type- Returns:
- the output type adapter corresponding to the current traffic assignment and output type
-
executeEquilibration
public abstract void executeEquilibration() throws PlanItExceptionRun equilibration after resources initialized, including saving results- Throws:
PlanItException- thrown if there is an error
-
getIterationIndex
public abstract int getIterationIndex()
Collect the current iteration index of the simulation- Returns:
- current iteration index
-
execute
public void execute() throws PlanItExceptionExecute assignment, including initializing resources, running equilibration and then closing resources- Throws:
PlanItException- thrown if there is an error
-
getTransportNetwork
public TransportNetwork getTransportNetwork()
Get the TransportNetwork used in the current assignment- Returns:
- TransportNetwork used in current assignment
-
setSmoothing
public void setSmoothing(Smoothing smoothing)
Set the Smoothing object for the current assignment- Parameters:
smoothing- Smoothing object for the current assignment
-
getSmoothing
public Smoothing getSmoothing()
Collect the smoothing object for the current traffic assignment- Returns:
- smoothing
-
setGapFunction
public void setGapFunction(GapFunction gapfunction)
Collect the gap function which is to be set by a derived class of TrafficAssignment via the initialiseDefaults() right after construction- Parameters:
gapfunction- the gap function to set
-
getGapFunction
public GapFunction getGapFunction()
Collect the gap function which is to be set by a derived class of TrafficAssignment via the initialiseDefaults() right after construction- Returns:
- gapFunction
-
setInfrastructureNetwork
public void setInfrastructureNetwork(InfrastructureNetwork network)
Set the network for the current assignment- Parameters:
network- the network object for the current assignment
-
setDemands
public void setDemands(Demands demands)
Set the Demands object for the current assignment- Parameters:
demands- the Demands object for the current assignment
-
setZoning
public void setZoning(Zoning zoning)
Set the zoning object for the current assignment- Parameters:
zoning- the Zoning object for the current assignment
-
setInitialLinkSegmentCost
public void setInitialLinkSegmentCost(InitialLinkSegmentCost initialLinkSegmentCost)
Set the initial link segment cost unrelated to any particular time period, i.e., used for all time periods that do not have designated initial costs specified for them- Parameters:
initialLinkSegmentCost- the initial link segment cost
-
setInitialLinkSegmentCost
public void setInitialLinkSegmentCost(TimePeriod timePeriod, InitialLinkSegmentCost initialLinkSegmentCost)
Set the initial link segment cost for a specified time period, otherwise revert to the general initial link segment cost (if any)- Parameters:
timePeriod- the specified time periodinitialLinkSegmentCost- the initial link segment cost
-
setPhysicalCost
public void setPhysicalCost(AbstractPhysicalCost physicalCost) throws PlanItException
Set the physical cost where in case the cost is an InteractorAccessor will trigger an event to get access to the required data via requesting an InteractorAccessee- Parameters:
physicalCost- the physical cost object for the current assignment- Throws:
PlanItException- thrown if there is an error
-
getPhysicalCost
public AbstractPhysicalCost getPhysicalCost()
Get the dynamic physical cost object for the current assignment- Returns:
- the physical cost object for the current assignment
-
getVirtualCost
public AbstractVirtualCost getVirtualCost()
Returns the virtual cost object for the current assignment- Returns:
- the virtual cost object for the current assignments
-
setVirtualCost
public void setVirtualCost(AbstractVirtualCost virtualCost) throws PlanItException
Set the virtual cost where in case the cost is an InteractorAccessor will trigger an event to get access to the required data via requesting an InteractorAccessee- Parameters:
virtualCost- the virtual cost object to be assigned- Throws:
PlanItException- thrown if there is an error
-
setOutputManager
public void setOutputManager(OutputManager outputManager)
Set the output manager which holds all the configuration options regarding this assignment- Parameters:
outputManager- to set
-
-