Class CostUtils


  • public class CostUtils
    extends Object
    Utilities to assist in prepping or filling low level array based costs for assignment or otherwise assuming concrete cost instances and network (virtual or otherwise) are available.
    Author:
    markr
    • Constructor Detail

      • CostUtils

        public CostUtils()
    • Method Detail

      • createEmptyLinkSegmentCostArray

        public static double[] createEmptyLinkSegmentCostArray​(UntypedPhysicalNetwork network,
                                                               Zoning zoning)
        Create an empty cost array for all link segments in both virtual and physical part of the network
        Parameters:
        network - to use
        zoning - to apply to virtual part of network
        Returns:
        generalised cost array by link segment id
      • createEmptyLinkSegmentCostArray

        public static double[] createEmptyLinkSegmentCostArray​(UntypedPhysicalNetwork network)
        Create an empty cost array for all physical link segments assuming ONLY physical link segments exist
        Parameters:
        network - to use
        Returns:
        generalised cost array by link segment id
      • populateModalVirtualLinkSegmentCosts

        public static void populateModalVirtualLinkSegmentCosts​(Mode mode,
                                                                VirtualCost virtualCost,
                                                                VirtualNetwork virtualNetwork,
                                                                double[] costArray)
        Populate part of cost array for virtual link segment costs based on the concrete cost class, for a given mode
        Parameters:
        mode - to use
        virtualCost - to apply to virtual part of network
        virtualNetwork - virtualNetwork containing virtual part of the network
        costArray - to fill
      • populateModalPhysicalLinkSegmentCosts

        public static void populateModalPhysicalLinkSegmentCosts​(Mode mode,
                                                                 AbstractPhysicalCost physicalCost,
                                                                 UntypedPhysicalNetwork network,
                                                                 double[] costArray)
        Populate part of cost array with physical link segment costs based on the concrete cost class, for a given mode
        Parameters:
        mode - to use
        physicalCost - to apply to physical part of network
        network - physical network
        costArray - to fill
      • createAndPopulateModalSegmentCost

        public static double[] createAndPopulateModalSegmentCost​(Mode mode,
                                                                 AbstractPhysicalCost physicalCost,
                                                                 UntypedPhysicalNetwork network)
        Populate cost array with only physical link segment costs based on the concrete cost classes, for given mode. Note that this requires no edge segments of any other type than physical link segments to be present, otherwise the indexing in the raw cost array may be inconsistent
        Parameters:
        mode - to use
        physicalCost - to apply to physical part of network
        network - physical network
        Returns:
        generalised cost array by link segment id
      • createAndPopulateModalSegmentCost

        public static double[] createAndPopulateModalSegmentCost​(Mode mode,
                                                                 VirtualCost virtualCost,
                                                                 AbstractPhysicalCost physicalCost,
                                                                 UntypedPhysicalNetwork network,
                                                                 Zoning zoning)
        Populate entire cost array with both virtual and non-virtual link segment costs based on the concrete cost classes, for given mode
        Parameters:
        mode - to use
        virtualCost - to apply to virtual part of network
        physicalCost - to apply to physical part of network
        network - physical network
        zoning - zoning containing virtual part of the network
        Returns:
        generalised cost array by link segment id