EstimatedODMatrix

public class EstimatedODMatrix extends RealODMatrix

Origin-destination matrix created from productions, attractions and observed trip length distribution.

Author:Milan Lovric

Fields

BIN_LIMITS_KM

public static final double[] BIN_LIMITS_KM

BIN_LIMITS_MILES

public static final int[] BIN_LIMITS_MILES

OTLD

public static final double[] OTLD

Constructors

EstimatedODMatrix

public EstimatedODMatrix(HashMap<String, Integer> productions, HashMap<String, Integer> attractions, SkimMatrix distanceSkimMatrix, double[] binLimitsKm, double[] observedTripLengthDistribution)

Constructor for estimated OD matrix.

Parameters:
  • productions – Productions
  • attractions – Attractions
  • distanceSkimMatrix – Distance skim matrix
  • binLimitsKm – Bin limits in km
  • observedTripLengthDistribution – Observed trip length distribution (normalised).

EstimatedODMatrix

public EstimatedODMatrix(String fileName, SkimMatrix distanceSkimMatrix, double[] binLimitsKm, double[] observedTripLengthDistribution)

Constructor for estimated OD matrix that reads productions and attractions from an input csv file.

Parameters:
  • fileName – Path to the input file with productions and attractions
  • distanceSkimMatrix – Distance skim matrix
  • binLimitsKm – Bin limits in km
  • observedTripLengthDistribution – Observed trip length distribution (normalised).
Throws:
  • IOException – if any.
  • FileNotFoundException – if any.

Methods

createUnitMatrix

public void createUnitMatrix()

Creates a unit OD matrix (all ones).

deleteInterzonalFlows

public void deleteInterzonalFlows(String zone)

Deletes all inter-zonal flows to/from a particular zone (leaving only intra-zonal flows)

Parameters:
  • zone – Zone for which inter-zonal flows need to be deleted from the origin-destination matrix.

getAttractions

public HashMap<String, Integer> getAttractions()

Getter method for the attractions.

Returns:Attractions

getBinIndexMatrix

public ODMatrixMultiKey getBinIndexMatrix()

Getter method for the bin index matrix.

Returns:Bin index matrix

getObservedTripLengthDistribution

public double[] getObservedTripLengthDistribution()

Getter method for the observed trip length distribution.

Returns:Observed trip length distribution

getProductions

public HashMap<String, Integer> getProductions()

Getter method for the productions.

Returns:Productions

getTripLengthDistribution

public double[] getTripLengthDistribution()

Getter method for the trip length distribution.

Returns:Trip length distribution

iterate

public void iterate()

Iterates scaling to productions, scaling to attractions, rounding and scaling to observed trip length distribution.

printMatrixFormatted

public void printMatrixFormatted(int precision)

Prints the matrix as a formatted table.

printMatrixFormatted

public void printMatrixFormatted(String message, int precision)

Prints the message and the matrix as a formatted table.

scaleToAttractions

public void scaleToAttractions()

Scales OD matrix to attractions.

scaleToObservedTripLenghtDistribution

public void scaleToObservedTripLenghtDistribution()

Scales OD matrix to observed trip length distribution.

scaleToProductions

public void scaleToProductions()

Scales OD matrix to productions.

updateTripLengthDistribution

public void updateTripLengthDistribution()

Updates trip length distribution (using the current values of the OD matrix).