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 String
ALGORITHM_B
short hand to choose algorithmB as assignment typeprotected Demands
demands
The demand to usestatic String
ELTM
short hand to choose eLTM as assignment typeprotected InitialLinkSegmentCost
initialLinkSegmentCost
The initial link segment costprotected Map<TimePeriod,InitialLinkSegmentCost>
initialLinkSegmentCostByTimePeriod
Map storing InitialLinkSegmentCost objects for each time periodprotected int
numberOfNetworkSegments
holds the count of all link segments in the transport networkprotected int
numberOfNetworkVertices
holds the count of all vertices in the transport networkprotected AbstractPhysicalCost
physicalCost
The physical generalized cost approachprotected Smoothing
smoothing
the smoothing to usestatic String
TRADITIONAL_STATIC_ASSIGNMENT
short hand to choose traditional static assignment as assignment typeprotected TransportNetwork
transportNetwork
The transport network to use which is an adaptor around the physical network and the zoningprotected AbstractVirtualCost
virtualCost
The 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 void
checkForEmptyComponents()
Check if any components are undefined, if so throw exceptionprotected String
createLoggingPrefix(int iterationIndex)
create the logging prefix for logging statements during equilibrationabstract OutputTypeAdapter
createOutputTypeAdapter(OutputType outputType)
Create the output type adapter for the current output type, specifically tailored towards the assignment type that we are builingprotected void
createTransportNetwork()
Initialize the transport network by combining the physical and virtual componentsprotected void
disbandTransportNetwork()
detach the virtual and physical transport network againvoid
execute()
Execute assignment, including initializing resources, running equilibration and then closing resourcesabstract void
executeEquilibration()
Run equilibration after resources initialized, including saving resultsprotected void
finalizeAfterExecution()
Finalize all relevant traffic assignment components after execution of the assignment has endedGapFunction
getGapFunction()
Collect the gap function which is to be set by a derived class of TrafficAssignment via the initialiseDefaults() right after constructionabstract int
getIterationIndex()
Collect the current iteration index of the simulationprotected OutputManager
getOutputManager()
Collect the output managerAbstractPhysicalCost
getPhysicalCost()
Get the dynamic physical cost object for the current assignmentSmoothing
getSmoothing()
Collect the smoothing object for the current traffic assignmentTransportNetwork
getTransportNetwork()
Get the TransportNetwork used in the current assignmentAbstractVirtualCost
getVirtualCost()
Returns the virtual cost object for the current assignmentprotected void
initialiseBeforeExecution()
Initialize all relevant traffic assignment components before execution of the assignment commencesvoid
setDemands(Demands demands)
Set the Demands object for the current assignmentvoid
setGapFunction(GapFunction gapfunction)
Collect the gap function which is to be set by a derived class of TrafficAssignment via the initialiseDefaults() right after constructionvoid
setInfrastructureNetwork(InfrastructureNetwork network)
Set the network for the current assignmentvoid
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 themvoid
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)void
setOutputManager(OutputManager outputManager)
Set the output manager which holds all the configuration options regarding this assignmentvoid
setPhysicalCost(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 InteractorAccesseevoid
setSmoothing(Smoothing smoothing)
Set the Smoothing object for the current assignmentvoid
setVirtualCost(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 InteractorAccesseevoid
setZoning(Zoning zoning)
Set the zoning object for the current assignmentprotected void
verifyComponentCompatibility()
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 PlanItException
Check if any components are undefined, if so throw exception- Throws:
PlanItException
- thrown if any components are undefined
-
verifyComponentCompatibility
protected void verifyComponentCompatibility() throws PlanItException
Verify if the traffic assignment components are compatible and nonnull- Throws:
PlanItException
- thrown if the components are not compatible
-
createTransportNetwork
protected void createTransportNetwork() throws PlanItException
Initialize the transport network by combining the physical and virtual components- Throws:
PlanItException
- thrown if there is an error
-
disbandTransportNetwork
protected void disbandTransportNetwork() throws PlanItException
detach the virtual and physical transport network again- Throws:
PlanItException
- thrown if there is an error
-
initialiseBeforeExecution
protected void initialiseBeforeExecution() throws PlanItException
Initialize all relevant traffic assignment components before execution of the assignment commences- Throws:
PlanItException
- thrown if there is an error
-
finalizeAfterExecution
protected void finalizeAfterExecution() throws PlanItException
Finalize 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 PlanItException
Run 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 PlanItException
Execute 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
-
-