Class TrafficAssignmentBuilder
- java.lang.Object
-
- org.planit.trafficassignment.builder.TrafficAssignmentBuilder
-
- Direct Known Subclasses:
CapacityConstrainedTrafficAssignmentBuilder
,TraditionalStaticAssignmentBuilder
public abstract class TrafficAssignmentBuilder extends Object
All traffic assignment instances require a network, demand, and (equilibrium) smoothing procedure, all of which should be registered via this generic builder. Specific traffic assignment methods might require special builders derived from this builder- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected TrafficAssignment
parentAssignment
The assignment all components will be registered onprotected TrafficAssignmentComponentFactory<PhysicalCost>
physicalCostFactory
Cost factory to create physical costs to register on the generalized cost.protected TrafficAssignmentComponentFactory<Smoothing>
smoothingFactory
The smoothing factory used in the assignment algorithm NB: The smoothing factory is defined here because the same smoothing algorithm is used for all assignments.protected TrafficAssignmentComponentFactory<VirtualCost>
virtualCostFactory
Cost factory to create physical costs to register on the generalized cost.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputTypeConfiguration
activateOutput(OutputType outputType)
Method that allows one to activate specific output types for persistence on the traffic assignment instancePhysicalCost
createAndRegisterPhysicalCost(String physicalTraveltimeCostFunctionType)
Create and register physical link cost function to determine travel timeSmoothing
createAndRegisterSmoothing(String smoothingType)
Create and Register smoothing componentVirtualCost
createAndRegisterVirtualCost(String virtualTraveltimeCostFunctionType)
Create and Register virtual link cost function to determine travel timeprotected GapFunction
createGapFunction()
Currently, there exists only a single gap function (link based relative duality gap) that is created via this factory method.void
deactivateOutput(OutputType outputType)
Deactivate an output typeGapFunction
getGapFunction()
Collect the gap function of the trafficAssignment instanceOutputConfiguration
getOutputConfiguration()
Provide the output configuration for user accessList<OutputFormatter>
getOutputFormatters()
Returns a list of output formatters registered on this assignmentPhysicalCost
getPhysicalCost()
Collect the physical cost entity registered on the traffic assignmentSmoothing
getSmoothing()
Collect the smoothing entity registered on the traffic assignmentVirtualCost
getVirtualCost()
Collect the virtual cost entity registered on the traffic assignmentvoid
initialiseDefaults()
Initialize the traffic assignment defaults for the activated assignment method:boolean
isOutputTypeActive(OutputType outputType)
Verify if a given output type is activevoid
registerInitialLinkSegmentCost(InitialLinkSegmentCost initialLinkSegmentCost)
Register the initial link segment cost without relating it to a particular period, meaning that it is applied to all time periods that do not have a specified initial link segment costs registered for themvoid
registerInitialLinkSegmentCost(InitialLinkSegmentCostPeriod initialLinkSegmentCost)
Register the initial link segment cost for the time period embedded in itvoid
registerInitialLinkSegmentCost(TimePeriod timePeriod, InitialLinkSegmentCost initialLinkSegmentCost)
Register the initial link segment cost for a specified time periodvoid
registerOutputFormatter(OutputFormatter outputFormatter)
Register an output formattervoid
unregisterOutputFormatter(OutputFormatter outputFormatter)
Remove an output formatter which has already been registered This is used by the Python interface, which registers the PlanItIO formatter by default
-
-
-
Field Detail
-
smoothingFactory
protected final TrafficAssignmentComponentFactory<Smoothing> smoothingFactory
The smoothing factory used in the assignment algorithm NB: The smoothing factory is defined here because the same smoothing algorithm is used for all assignments. If we later decide to use more than one smoothing algorithm and allow different traffic assignments to use different smoothing algorithms, we would need to move this property and its handler methods to CustomPlanItProject and treat it like the factories for PhysicalNetwork, Demands and Zoning (and allow the different smoothing algorithms to be registered on the project).
-
physicalCostFactory
protected final TrafficAssignmentComponentFactory<PhysicalCost> physicalCostFactory
Cost factory to create physical costs to register on the generalized cost.
-
virtualCostFactory
protected final TrafficAssignmentComponentFactory<VirtualCost> virtualCostFactory
Cost factory to create physical costs to register on the generalized cost.
-
parentAssignment
protected final TrafficAssignment parentAssignment
The assignment all components will be registered on
-
-
Method Detail
-
createGapFunction
protected GapFunction createGapFunction()
Currently, there exists only a single gap function (link based relative duality gap) that is created via this factory method. It should be injected by each traffic assignment method until we have multiple gap functions, in which case, it becomes an option like other components.- Returns:
- the created gap function
-
initialiseDefaults
public void initialiseDefaults() throws PlanItException
Initialize the traffic assignment defaults for the activated assignment method:- Throws:
PlanItException
- thrown when there is an error
-
createAndRegisterSmoothing
public Smoothing createAndRegisterSmoothing(String smoothingType) throws PlanItException
Create and Register smoothing component- Parameters:
smoothingType
- the type of smoothing component to be created- Returns:
- Smoothing object created
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterPhysicalCost
public PhysicalCost createAndRegisterPhysicalCost(String physicalTraveltimeCostFunctionType) throws PlanItException
Create and register physical link cost function to determine travel time- Parameters:
physicalTraveltimeCostFunctionType
- the type of cost function to be created- Returns:
- the physical cost created
- Throws:
PlanItException
- thrown if there is an error
-
createAndRegisterVirtualCost
public VirtualCost createAndRegisterVirtualCost(String virtualTraveltimeCostFunctionType) throws PlanItException
Create and Register virtual link cost function to determine travel time- Parameters:
virtualTraveltimeCostFunctionType
- the type of cost function to be created- Returns:
- the cost function created
- Throws:
PlanItException
- thrown if there is an error
-
registerOutputFormatter
public void registerOutputFormatter(OutputFormatter outputFormatter) throws PlanItException
Register an output formatter- Parameters:
outputFormatter
- OutputFormatter being registered- Throws:
PlanItException
- thrown if there is an error or validation failure during setup of the output formatter
-
unregisterOutputFormatter
public void unregisterOutputFormatter(OutputFormatter outputFormatter) throws PlanItException
Remove an output formatter which has already been registered This is used by the Python interface, which registers the PlanItIO formatter by default- Parameters:
outputFormatter
- the output formatter to be removed- Throws:
PlanItException
- thrown if there is an error during removal of the output formatter
-
getOutputFormatters
public List<OutputFormatter> getOutputFormatters()
Returns a list of output formatters registered on this assignment- Returns:
- List of OutputFormatter objects registered on this assignment
-
registerInitialLinkSegmentCost
public void registerInitialLinkSegmentCost(InitialLinkSegmentCost initialLinkSegmentCost)
Register the initial link segment cost without relating it to a particular period, meaning that it is applied to all time periods that do not have a specified initial link segment costs registered for them- Parameters:
initialLinkSegmentCost
- initial link segment cost for the current traffic assignment
-
registerInitialLinkSegmentCost
public void registerInitialLinkSegmentCost(InitialLinkSegmentCostPeriod initialLinkSegmentCost) throws PlanItException
Register the initial link segment cost for the time period embedded in it- Parameters:
initialLinkSegmentCost
- initial link segment cost for the current traffic assignment- Throws:
PlanItException
- thrown if time period in initial costs is null
-
registerInitialLinkSegmentCost
public void registerInitialLinkSegmentCost(TimePeriod timePeriod, InitialLinkSegmentCost initialLinkSegmentCost) throws PlanItException
Register the initial link segment cost for a specified time period- Parameters:
timePeriod
- the specified time periodinitialLinkSegmentCost
- initial link segment cost for the current traffic assignment- Throws:
PlanItException
- thrown if time period is null
-
activateOutput
public OutputTypeConfiguration activateOutput(OutputType outputType) throws PlanItException
Method that allows one to activate specific output types for persistence on the traffic assignment instance- Parameters:
outputType
- OutputType object to be used- Returns:
- outputTypeConfiguration the output type configuration that is now active
- Throws:
PlanItException
- thrown if there is an error activating the output
-
deactivateOutput
public void deactivateOutput(OutputType outputType)
Deactivate an output type- Parameters:
outputType
- OutputType to be deactivated
-
isOutputTypeActive
public boolean isOutputTypeActive(OutputType outputType)
Verify if a given output type is active- Parameters:
outputType
- the output type to verify for- Returns:
- true if active, false otherwise
-
getOutputConfiguration
public OutputConfiguration getOutputConfiguration()
Provide the output configuration for user access- Returns:
- outputConfiguration for this traffic assignment
-
getGapFunction
public GapFunction getGapFunction()
Collect the gap function of the trafficAssignment instance- Returns:
- gapFunction
-
getPhysicalCost
public PhysicalCost getPhysicalCost()
Collect the physical cost entity registered on the traffic assignment- Returns:
- physicalCost
-
getVirtualCost
public VirtualCost getVirtualCost()
Collect the virtual cost entity registered on the traffic assignment- Returns:
- smoothing
-
getSmoothing
public Smoothing getSmoothing()
Collect the smoothing entity registered on the traffic assignment- Returns:
- smoothing
-
-