Home Numerical Excel Tutorial Microscopic Pedestrian Simulation Kardi Teknomo's Tutorial Micro-PedSim Free Download Personal Development Handbook

 Research Publications Tutorials Resume Resources Contact

Static Traffic Analysis: Java program

< Previous | Index | Next >

### Documentation

To support the formulations in the paper by Dr. Teknomo & Dr. Fernandez, I created Java programs that the documentation is given as follow:

I. Classes

The project contains 5 classes:

• Graph.class – data structure for graphs in the form of adjacency matrix, but includes the relevant graph matrices (distance, external) and the binary forms thereof. Also includes the methods to compute these matrices.
• GraphFileReader.class – contains a single method that creates a Graph structure from an input file and automatically calls the matrix calculation methods
• Trajectory.class – data structure for trajectories in the form of a linked list of integers
• TrajectoryFileReader.class – contains a single method that creates a Trajectory structure from an input file
• Static.class – the main class. It contains the method calls to read and create Graph and Trajectory objects from the input file. It also stores the matrices relevant to (static) traffic analysis such as the flow matrices and OD matrices. The main method specifically does the following things in order: (1) creates the Graph from a file, (2) creates the Trajectory array from a file, (3) initialize and compute the relevant traffic matrices, (4) calls the beginTesting() method to verify that the proven properties of the matrices hold.

II. File Formats

The Graph and Trajectory objects are created from input files. The following are the specifications for these input files.

• Graphs – the input file should be an n*n adjacency matrix separated by spaces
• Trajectories – the input file should start with a single positive integer m, which contains the number of trajectories that follow. For each of the following m lines, a trajectory is specified by indicating a sequence of integers separated by spaces. (These integers refer to node numbers in the graph.) Note that node numbers begin with 0.

III. Execution and Parameters

The program may be run by typing the following line:

java Static [path to graph input file] [path to trajectories input file]

You may specify either both or none of the parameters. If no parameters are specified, the default parameters will be used. These parameters are located in Static.class and are called graphFilePath and trajFilePath, respectively.

Preferable reference for this tutorial is

Teknomo, Kardi. (2013) Relationship between Generalized Origin Destination and Flow Matrix – A Tutorial
http://people.revoledu.com/kardi/research/trajectory/od/