We will demonstrate how to create a highway program to perform a simple assignment. In the simple example, we will cover scripting for assignment, get skim martrix (**PATHTRACE**), perform select link analysis (**SELECTLINK**), get path information (**TRACE**) and how to use converge phase.

We will shown all these functions using simple network and data structure. Most of the values can be valid by manual calculations. If one is interested in understanding the details, you are always encouraged to do so. Also, once you download the sample catalog, please feel free to use it for simple testing and practice other key words in HIGHWAY.

The network is give below:

We only have 2 zones (1&2) and 5 arterial links (blue links). Link 1-101 and link 104-2 are centroid connectors. There are 10 trips going from zone 1 to zone 2. Note: in this simple case, all links are one-way!

We will perform our assignment based on TIME, as calculated by the following:

TIME=T0+V/C

**Discussion on Sample Catalog:**

**1. HIGHWAY 1:**

Gives you one simple example of assignment. Please run it and check its PRN file. You can also open the output network (loadedNet1.net). You will find new attributes added to this network (V_1, TIME_1, ect.). If you are not sure about what they are. You can find them in the Cube Help.

**2. HIGHWAY 2:**

This program shows how to use PATHTRACE, SELECTLINK, and TRACE. PATHTRACE gives you the skim matrix in TIME (one can change it to Distance or LW attributes). SELECTLINK will gives you the volumes using LINK=101-102. One can verify it in the output network. TRACE gives you the detailed path information and you can find it in run PRN file:

*PATH(TIME) 1->2: 101=0 102=2 103=2.5 104=3 2=3
PATH(TIME) 1->2: 101=0 103=3 104=4.5 2=4.5*

1st Iteration: we have a path 1-101-102-103-104-2 and the path time is 3. You can verify it by manual calculation using free flow time (T0).

2nd Iteration: we have a path 1-101-103-104-2 and the path time is 4.5. Again, you can verify it using Time function.

More on Skim Matrix:

If one opens the skim matrix, you will find a value=3.75. How is this value calculated? This value is a weighted value. The weights are consistent with the weights used for flow combination (defined by PARAMETER COMBINE= ****). In our example, we use AVE. The skim value is calculated by sum over values and divided by 2, i.e. (3+4.5)/2=3.75.

**3. HIGHWAY 3**

Some users may not need combined skim matrices and/or need detailed information of the path. One can use COMBINE=F under MATO to get the statistics only at the last iteration and use PRINT and LIST with TRACE to print out path information into an external file. They are shown in this program. Just check the output skim matrix and the path file gives the link by link information.

** 4. HIGHWAY 4**

Now we are going to discuss how to control the assignment process by using stopping criteria. Please open the script file and check how the parameters are defined.

PARAMETERS COMBINE = AVE ;flow combination is using average method

PARAMETERS MAXITERS=50 ;set max iteration=20

PARAMETERS GAP=0.001 ;set GAP value for convergence check

Some users will think by the settings, the run will either terminated at Iteration 50 or when the gap is 0.001. Now run the program, and check the run PRN file. From there, we can find the process terminated at iteration 6, with gap value = 0.00210

How does that happen?

The reason is that there are a set of stopping criteria used by Cube and each of them has a default value.See below:

PAR: LAMBDA=0 GAP=0.005 AAD=0.5 RAAD=0.005 PDIFF=1 RMSE=0.1 PDIFFVALUE=0

PAR: RELATIVEGAP=0

By setting GAP=0.001 one just change the default value for GAP. But the program will check all above criteria and terminate the process if any of them met. In our case is ADD!

**5. HIGHWAY 5**

In this program, we will add a CONVERGE Phase to fully control the convergence checking process of the assignment.

PROCESS PHASE=CONVERGE

;one can define any customized convergence check here

IF(GAP< GAPCUTOFF) ;convergence check

BALANCE=1

ENDIF

ENDPROCESS

Just run the program and check its report PRN file.

practiceHighway.rar (37.0 KB)