Package org.goplanit.cost
Class CostUtils
- java.lang.Object
-
- org.goplanit.cost.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 Summary
Constructors Constructor Description CostUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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 modestatic double[]
createEmptyLinkSegmentCostArray(UntypedPhysicalNetwork network)
Create an empty cost array for all physical link segments assuming ONLY physical link segments existstatic double[]
createEmptyLinkSegmentCostArray(UntypedPhysicalNetwork network, Zoning zoning)
Create an empty cost array for all link segments in both virtual and physical part of the networkstatic 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 modestatic 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
-
-
-
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 usezoning
- 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 usevirtualCost
- to apply to virtual part of networkvirtualNetwork
- virtualNetwork containing virtual part of the networkcostArray
- 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 usephysicalCost
- to apply to physical part of networknetwork
- physical networkcostArray
- 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 usephysicalCost
- to apply to physical part of networknetwork
- 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 usevirtualCost
- to apply to virtual part of networkphysicalCost
- to apply to physical part of networknetwork
- physical networkzoning
- zoning containing virtual part of the network- Returns:
- generalised cost array by link segment id
-
-