SkimMatrixFreight

public interface SkimMatrixFreight

Skim matrix for storing inter-zonal travel times or costs (for freight vehicles).

Author:Milan Lovric

Fields

MAX_FREIGHT_ZONE_ID

public static final int MAX_FREIGHT_ZONE_ID

MAX_VEHICLE_ID

public static final int MAX_VEHICLE_ID

Methods

getAbsoluteDifference

public double getAbsoluteDifference(SkimMatrixFreight other)

Gets sum of absolute differences between elements of two matrices.

Parameters:
  • other – The other matrix.
Returns:

Sum of absolute differences.

getAverageCost

public double getAverageCost()

Gets average cost.

Returns:Average cost.

getAverageCost

public double getAverageCost(FreightMatrix demand)

Gets average cost weighted by the freight demand.

Parameters:
  • demand – Freight OD matrix.
Returns:

Average cost weighted by freight matrix.

getCost

public double getCost(int originZone, int destinationZone, int vehicleType)

Gets cost for a given origin-destination pair and a vehicle type.

Parameters:
  • originZone – Origin zone.
  • destinationZone – Destination zone.
  • vehicleType – Vehicle type.
Returns:

Origin-destination cost.

printMatrix

public void printMatrix()

Prints the matrix.

printMatrixFormatted

public void printMatrixFormatted()

Prints the matrix as a formatted table.

printMatrixFormatted

public void printMatrixFormatted(String s)

Prints the matrix as a formatted table, with a print message.

Parameters:
  • s – Print message

saveMatrixFormatted

public void saveMatrixFormatted(String outputFile)

Saves the matrix into a csv file (list format for freight).

Parameters:
  • outputFile – Path to the output file.

setCost

public void setCost(int originZone, int destinationZone, int vehicleType, double cost)

Sets cost for a given origin-destination pair and a vehicle type.

Parameters:
  • originZone – Origin zone.
  • destinationZone – Destination zone.
  • vehicleType – Vehicle type.
  • cost – Origin-destination cost.