Class CustomPlanItProject

  • Direct Known Subclasses:
    PlanItProject, PlanItSimpleProject, TntpProject

    public class CustomPlanItProject
    extends Object
    The top-level class which hosts a single project. A project can consist of multiple networks, demands and traffic assignments all based on a single configuration (user classes, modes etc.)
    Author:
    markr
    • Field Detail

      • id

        protected final long id
        unique identifier for this project across all projects in the JVM
      • projectToken

        protected IdGroupingToken projectToken
        id generation using this token will be contiguous and unique for all instances created with this token. This token is related to the current instance of this class, i.e., the project
      • inputs

        protected final PlanItProjectInput inputs
        The input container holding all traffic assignment input components and related functionality with respect to project management
      • inputBuilderListener

        protected final InputBuilderListener inputBuilderListener
        the listener that we register on each traffic assignment component creation event for external initialization
      • outputFormatters

        protected final TreeMap<Long,​OutputFormatter> outputFormatters
        The output formatter(s) registered on this project
      • physicalNetworks

        public final ProjectNetworks physicalNetworks
        The registered physical networks
    • Constructor Detail

      • CustomPlanItProject

        public CustomPlanItProject​(InputBuilderListener inputBuilderListener)
        Constructor which reads in the input builder listener and instantiates the object factory classes. This constructor instantiates the EventManager, which must be a singleton class for the whole application.
        Parameters:
        inputBuilderListener - InputBuilderListener used to read in data
    • Method Detail

      • executeTrafficAssignment

        protected void executeTrafficAssignment​(TrafficAssignment ta)
        Execute a particular traffic assignment
        Parameters:
        ta - TrafficAssignment to be run
      • registerEligibleTrafficComponentClass

        public void registerEligibleTrafficComponentClass​(Class<? extends PlanitComponent<?>> theClazz)
                                                   throws PlanItException
        Register a class that we allow to be instantiated as a concrete implementation of a traffic assignment component that can be used in PLANit
        Parameters:
        theClazz - the class that we want to mark as eligible from an outside source
        Throws:
        PlanItException - thrown if class cannot be registered
      • createAndRegisterInfrastructureNetwork

        public LayeredNetwork<?,​?> createAndRegisterInfrastructureNetwork​(String infrastructureNetworkType)
                                                                         throws PlanItException
        Create and register an infrastructure based network on the project
        Parameters:
        infrastructureNetworkType - name of infrastructure network class to register
        Returns:
        the generated infrastructure network
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterMacroscopicNetwork

        public MacroscopicNetwork createAndRegisterMacroscopicNetwork()
                                                               throws PlanItException
        Create and register a macroscopic network on the project
        Returns:
        the generated macroscopic network
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterZoning

        public Zoning createAndRegisterZoning​(LayeredNetwork<?,​?> network)
                                       throws PlanItException
        Create and register the zoning system on the network
        Parameters:
        network - the network on which the zoning will be based
        Returns:
        the generated zoning object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterDemands

        public Demands createAndRegisterDemands​(Zoning zoning,
                                                LayeredNetwork<?,​?> network)
                                         throws PlanItException
        Create and register demands to the project
        Parameters:
        zoning - Zoning object which defines the zones which will be used in the demand matrix to be created
        network - the network which stores the modes (demands can different for each mode)
        Returns:
        the generated demands object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterServiceNetwork

        public ServiceNetwork createAndRegisterServiceNetwork​(MacroscopicNetwork network)
                                                       throws PlanItException
        Create and register service networks to the project
        Parameters:
        network - the network upon which the service network is built
        Returns:
        the generated service network object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterRoutedServices

        public RoutedServices createAndRegisterRoutedServices​(ServiceNetwork serviceNetwork)
                                                       throws PlanItException
        Create and register routed services to the project
        Parameters:
        serviceNetwork - the service network upon which the routed services are defined
        Returns:
        the generated routed services object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterOdPathSets

        public OdPathSets createAndRegisterOdPathSets​(NetworkLayer networkLayer,
                                                      Zoning zoning,
                                                      String odPathSetInputPath)
                                               throws PlanItException
        Create and register the OD path sets as populated by the input builder through the path source
        Parameters:
        networkLayer - network layer the paths must be compatible with
        zoning - zoning to match od paths to
        odPathSetInputPath - path to collect the paths from
        Returns:
        od path sets that have been parsed
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterTrafficAssignment

        public TrafficAssignmentConfigurator<? extends TrafficAssignment> createAndRegisterTrafficAssignment​(String trafficAssignmentType,
                                                                                                             Demands theDemands,
                                                                                                             Zoning theZoning,
                                                                                                             LayeredNetwork<?,​?> theNetwork)
                                                                                                      throws PlanItException
        Create and register a traffic assignment instance of a given type
        Parameters:
        trafficAssignmentType - the class name of the traffic assignment type object to be created
        theDemands - the demands
        theZoning - the zoning
        theNetwork - the network
        Returns:
        the traffic assignment configurator object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterInitialLinkSegmentCost

        public InitialMacroscopicLinkSegmentCost createAndRegisterInitialLinkSegmentCost​(LayeredNetwork<?,​?> network,
                                                                                         String fileName)
                                                                                  throws PlanItException
        Create and register initial link segment costs from a (single) file which we assume are available in the native xml/csv output format as provided in this project
        Parameters:
        network - network the InitialLinkSegmentCost object will be registered for
        fileName - file containing the initial link segment cost values
        Returns:
        the InitialLinkSegmentCost object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterInitialLinkSegmentCost

        public InitialMacroscopicLinkSegmentCost createAndRegisterInitialLinkSegmentCost​(LayeredNetwork<?,​?> network,
                                                                                         String fileName,
                                                                                         TimePeriod timePeriod)
                                                                                  throws PlanItException
        Create and register initial link segment costs from a (single) file and register it to the provided time period
        Parameters:
        network - network the InitialLinkSegmentCost object will be registered for
        fileName - location of file containing the initial link segment cost values
        timePeriod - to register the initial cost on
        Returns:
        the InitialLinkSegmentCostPeriod object
        Throws:
        PlanItException - thrown if there is an error
      • createAndRegisterOutputFormatter

        public OutputFormatter createAndRegisterOutputFormatter​(String outputFormatterType)
                                                         throws PlanItException
        Create and register an output formatter instance of a given type
        Parameters:
        outputFormatterType - the class name of the output formatter type object to be created
        Returns:
        the generated output formatter object
        Throws:
        PlanItException - thrown if there is an error
      • getInitialLinkSegmentCost

        public List<InitialMacroscopicLinkSegmentCost> getInitialLinkSegmentCost​(LayeredNetwork<?,​?> network)
        Return the initial link segment costs for a network
        Parameters:
        network - the specified network
        Returns:
        the initial link segment costs for the specified physical network
      • getOutputFormatter

        public OutputFormatter getOutputFormatter​(long id)
        Retrieve an output formatter object given its id
        Parameters:
        id - the id of the output formatter object
        Returns:
        the retrieved output formatter object
      • executeAllTrafficAssignments

        public void executeAllTrafficAssignments()
                                          throws PlanItException
        Execute all registered traffic assignments Top-level error recording is done in this class. If several traffic assignments are registered and one fails, we record its error and continue with the next assignment.
        Throws:
        PlanItException - required for subclasses which override this method and generate an exception before the runs start