Class StaticLtmBushStrategyBase<B extends RootedBush<?,​?>>

    • Field Detail

      • bushes

        protected B extends RootedBush<?,​?>[] bushes
        tracked bushes (with non-zero demand)
      • pasManager

        protected final PasManager pasManager
        track all unique PASs
      • equalFlowDistributedPass

        protected Set<Pas> equalFlowDistributedPass
        track all PASs where we are attempting to distribute flow equally to obtain unique solution under unequal flow but equal cost/cost-derivative
    • Constructor Detail

      • StaticLtmBushStrategyBase

        protected StaticLtmBushStrategyBase​(IdGroupingToken idGroupingToken,
                                            long assignmentId,
                                            TransportModelNetwork transportModelNetwork,
                                            StaticLtmSettings settings,
                                            TrafficAssignmentComponentAccessee taComponents)
        Constructor
        Parameters:
        idGroupingToken - to use for internal managed ids
        assignmentId - of parent assignment
        transportModelNetwork - to use
        settings - to use
        taComponents - to use for access to user configured assignment components
    • Method Detail

      • updateGap

        protected void updateGap​(LinkBasedRelativeDualityGapFunction gapFunction,
                                 Pas pas,
                                 double s1SendingFlow,
                                 double s2SendingFlow)
        Update gap. Unconventional gap function where we update the GAP based on PAS cost discrepancy. This is due to the impossibility of efficiently determining the network and minimum path costs in a capacity constrained bush based setting. Instead we:

        minimumCost PAS : s1 cost * SUM(s1 sending flow, s2 sending flow) measuredCost PAS: s1 sending flow * s1 cost + s2 sending flow * s2 cost

        Sum the above over all PASs. Note that PASs can (partially) overlap, so the measured cost does likely not add up to the network cost

        Parameters:
        gapFunction - to use
        pas - to compute for
        s1SendingFlow - of the PAS s1 segment
        s2SendingFlow - of the PAS s2 segment
      • syncBushFlowsToNetworkFlows

        protected void syncBushFlowsToNetworkFlows()
        Based on the network loading results, update the bush' turn sending flows
      • updateBushPass

        protected abstract Collection<Pas> updateBushPass​(double[] linkSegmentCosts)
                                                   throws PlanItException
        Update the PASs for bushes given the network costs and current bushes DAGs
        Parameters:
        linkSegmentCosts - to use
        Returns:
        newly created PASs
        Throws:
        PlanItException - thrown if error
      • isSolutionFlowEntropyMaximised

        protected boolean isSolutionFlowEntropyMaximised​(double gapEpsilon)
        Verify if solution is flow proportional
        Parameters:
        gapEpsilon - to use
        Returns:
        true when flow proportional, false otherwise
      • createEmptyBushes

        protected abstract B[] createEmptyBushes()
        Let derived implementations create the empty bushes as desired before populating them
        Returns:
        created empty bushes suitable for this strategy
      • initialiseBush

        protected abstract void initialiseBush​(B bush,
                                               Zoning zoning,
                                               OdDemands odDemands,
                                               ShortestBushGeneralised shortestBushAlgorithm)
        Initialise the sLTM bush by including the relevant DAGs based on available demand and bush layout. When equal costs are found between alternative paths OD demand is to be split proportionally

        Add the edge segments to the bush and update the turn sending flow accordingly.

        Parameters:
        bush - to use
        zoning - to use
        odDemands - to use
        shortestBushAlgorithm - to use
      • createPasFlowShiftExecutor

        protected abstract PasFlowShiftExecutor createPasFlowShiftExecutor​(Pas pas,
                                                                           StaticLtmSettings settings)
        Parameters:
        pas - to create flow shift executor for
        settings - to use
        Returns:
        created executor
      • initialiseBushes

        protected void initialiseBushes​(double[] linkSegmentCosts)
                                 throws PlanItException
        Initialise bushes. Find shortest bush for each origin and add the links, flow, and destination labelling to the bush
        Parameters:
        linkSegmentCosts - costs to use
        Throws:
        PlanItException - thrown when error
      • createNetworkShortestBushAlgo

        protected ShortestBushGeneralised createNetworkShortestBushAlgo​(double[] linkSegmentCosts)
        Create a network wide shortest bush algorithm based on provided costs
        Parameters:
        linkSegmentCosts - to use
        Returns:
        one-to-all shortest bush algorithm
      • createNetworkShortestPathAlgo

        protected ShortestPathDijkstra createNetworkShortestPathAlgo​(double[] linkSegmentCosts)
        Create a network wide Dijkstra shortest path algorithm based on provided costs
        Parameters:
        linkSegmentCosts - to use
        Returns:
        Dijkstra shortest path algorithm
      • createInitialSolution

        public void createInitialSolution​(double[] initialLinkSegmentCosts)
        Create initial bushes, where for each origin the bush is initialised with the shortest path only
        Specified by:
        createInitialSolution in class StaticLtmAssignmentStrategy
        Parameters:
        initialLinkSegmentCosts - costs to use
      • performIteration

        public boolean performIteration​(Mode theMode,
                                        double[] costsToUpdate,
                                        int iterationIndex)
        Perform an iteration by: 1. Identify new PASs and shift flow from affected bushes 2. Conduct another loading update based on adjusted PASs and bushes 3. Update Bushes by shifting flow between existing PASs 4. Conducting a loading to obtain network costs
        Specified by:
        performIteration in class StaticLtmAssignmentStrategy
        Parameters:
        theMode - to use
        costsToUpdate - to place updated costs in (output)
        iterationIndex - we're at
        Returns:
        true when iteration could be successfully completed, false otherwise
      • hasConverged

        public boolean hasConverged​(GapFunction gapFunction,
                                    int iterationIndex)
        Unlike the default convergence check, we also see if the solution is proportional if relevant; in a bush setting with a triangular fundamental diagram we do not obtain a unique solution if a PAS has equal cost with an equal derivative but unequal flow distribution along its two segments, e.g. in free flow conditions we expect equal flow along both alternatives if equal cost. When the settings indicate so, we verify if the solution is proportional or not and only if so we indicate convergence has been reached.
        Overrides:
        hasConverged in class StaticLtmAssignmentStrategy
        Parameters:
        gapFunction - to use for regular convergence check on cost
        iterationIndex - at hand
        Returns:
        true when converged, false otherwise