Class 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 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).
      • 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 period
        initialLinkSegmentCost - 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