Package org.planit.assignment
Class TrafficAssignmentConfigurator<T extends TrafficAssignment>
- java.lang.Object
-
- org.planit.utils.builder.Configurator<T>
-
- org.planit.assignment.TrafficAssignmentConfigurator<T>
-
- Type Parameters:
T- traffic assignment type
- Direct Known Subclasses:
CapacityConstrainedTrafficAssignmentConfigurator,TraditionalStaticAssignmentConfigurator
public class TrafficAssignmentConfigurator<T extends TrafficAssignment> extends Configurator<T>
Configurator class for traffic assignment. Hides builder pattern from user while allowing for easy way to configure an assignment without having actual access to it.- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringSET_DEMANDSprotected static StringSET_GAP_FUNCTIONprotected static StringSET_INFRASTRUCTURE_NETWORKprotected static StringSET_INITIAL_LINK_SEGMENT_COSTprotected static StringSET_OUTPUT_MANAGERprotected static StringSET_PHYSICAL_COSTprotected static StringSET_VIRTUAL_COSTprotected static StringSET_ZONING-
Fields inherited from class org.planit.utils.builder.Configurator
delayedMethodCalls
-
-
Constructor Summary
Constructors Constructor Description TrafficAssignmentConfigurator(Class<T> instanceType)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputTypeConfigurationactivateOutput(OutputType outputType)Method that allows one to activate specific output types for persistence on the traffic assignment instancePhysicalCostConfigurator<? extends AbstractPhysicalCost>createAndRegisterPhysicalCost(String physicalTraveltimeCostFunctionType)Create and register physical link cost function to determine travel timeSmoothingConfigurator<? extends Smoothing>createAndRegisterSmoothing(String smoothingType)Create and Register smoothing componentVirtualCostConfigurator<? extends AbstractVirtualCost>createAndRegisterVirtualCost(String virtualTraveltimeCostFunctionType)Create and Register virtual link cost function to determine travel timevoiddeactivateOutput(OutputType outputType)Deactivate an output typeDemandsgetDemands()collect the registered demandsGapFunctionConfigurator<? extends GapFunction>getGapFunction()Collect the gap function of the trafficAssignment instanceInfrastructureNetworkgetInfrastructureNetwork()collect the registered networkOutputConfigurationgetOutputConfiguration()Provide the output configuration for user accessList<OutputFormatter>getOutputFormatters()Returns a list of output formatters registered on this assignmentprotected OutputManagergetOutputManager()Collect the registered output managerPhysicalCostConfigurator<? extends AbstractPhysicalCost>getPhysicalCost()Collect the physical cost entity registered on the traffic assignmentSmoothingConfigurator<? extends Smoothing>getSmoothing()Collect the smoothing entity registered on the traffic assignmentVirtualCostConfigurator<? extends AbstractVirtualCost>getVirtualCost()Collect the virtual cost entity registered on the traffic assignmentZoninggetZoning()collect the registered zoningbooleanisOutputTypeActive(OutputType outputType)Verify if a given output type is activevoidregisterInitialLinkSegmentCost(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 themvoidregisterInitialLinkSegmentCost(InitialLinkSegmentCostPeriod initialLinkSegmentCost)Register the initial link segment cost for the time period embedded in itvoidregisterInitialLinkSegmentCost(TimePeriod timePeriod, InitialLinkSegmentCost initialLinkSegmentCost)Register the initial link segment cost for a specified time periodvoidregisterOutputFormatter(OutputFormatter outputFormatter)Register an output formatterprotected voidsetDemands(Demands demands)Set the demandsprotected voidsetGapFunction(GapFunctionConfigurator<? extends GapFunction> gapFunctionConfigurator)Set the gap function configurator for this assignmentprotected voidsetInfrastructureNetwork(InfrastructureNetwork network)Set the networkprotected voidsetOutputManager(OutputManager outputManager)Set the output managerprotected voidsetZoning(Zoning zoning)Set the zoningvoidunregisterOutputFormatter(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-
Methods inherited from class org.planit.utils.builder.Configurator
callVoidMethod, collectParameterTypes, configure, getClassTypeToConfigure, getFirstParameterOfDelayedMethodCall, registerDelayedMethodCall
-
-
-
-
Field Detail
-
SET_OUTPUT_MANAGER
protected static final String SET_OUTPUT_MANAGER
- See Also:
- Constant Field Values
-
SET_GAP_FUNCTION
protected static final String SET_GAP_FUNCTION
- See Also:
- Constant Field Values
-
SET_VIRTUAL_COST
protected static final String SET_VIRTUAL_COST
- See Also:
- Constant Field Values
-
SET_PHYSICAL_COST
protected static final String SET_PHYSICAL_COST
- See Also:
- Constant Field Values
-
SET_INITIAL_LINK_SEGMENT_COST
protected static final String SET_INITIAL_LINK_SEGMENT_COST
- See Also:
- Constant Field Values
-
SET_INFRASTRUCTURE_NETWORK
protected static final String SET_INFRASTRUCTURE_NETWORK
- See Also:
- Constant Field Values
-
SET_ZONING
protected static final String SET_ZONING
- See Also:
- Constant Field Values
-
SET_DEMANDS
protected static final String SET_DEMANDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
setGapFunction
protected void setGapFunction(GapFunctionConfigurator<? extends GapFunction> gapFunctionConfigurator)
Set the gap function configurator for this assignment- Parameters:
gapFunctionConfigurator- to use
-
setInfrastructureNetwork
protected void setInfrastructureNetwork(InfrastructureNetwork network)
Set the network- Parameters:
network- to set
-
setZoning
protected void setZoning(Zoning zoning)
Set the zoning- Parameters:
zoning- to set
-
setDemands
protected void setDemands(Demands demands)
Set the demands- Parameters:
demands- to set
-
setOutputManager
protected void setOutputManager(OutputManager outputManager)
Set the output manager- Parameters:
outputManager- to set
-
getOutputManager
protected OutputManager getOutputManager()
Collect the registered output manager- Returns:
- collected outputManager
-
getInfrastructureNetwork
public InfrastructureNetwork getInfrastructureNetwork()
collect the registered network- Returns:
- network
-
getZoning
public Zoning getZoning()
collect the registered zoning- Returns:
- zoning
-
getDemands
public Demands getDemands()
collect the registered demands- Returns:
- demands
-
createAndRegisterSmoothing
public SmoothingConfigurator<? extends Smoothing> createAndRegisterSmoothing(String smoothingType) throws PlanItException
Create and Register smoothing component- Parameters:
smoothingType- the type of smoothing component to be created- Returns:
- Smoothing configuration object
- Throws:
PlanItException- thrown if there is an error
-
createAndRegisterPhysicalCost
public PhysicalCostConfigurator<? extends AbstractPhysicalCost> 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 VirtualCostConfigurator<? extends AbstractVirtualCost> 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 GapFunctionConfigurator<? extends GapFunction> getGapFunction()
Collect the gap function of the trafficAssignment instance- Returns:
- gapFunction
-
getPhysicalCost
public PhysicalCostConfigurator<? extends AbstractPhysicalCost> getPhysicalCost()
Collect the physical cost entity registered on the traffic assignment- Returns:
- physicalCost
-
getVirtualCost
public VirtualCostConfigurator<? extends AbstractVirtualCost> getVirtualCost()
Collect the virtual cost entity registered on the traffic assignment- Returns:
- virtual cost
-
getSmoothing
public SmoothingConfigurator<? extends Smoothing> getSmoothing()
Collect the smoothing entity registered on the traffic assignment- Returns:
- smoothing
-
-