Matrix manipulation is a common task in transportation modeling. In the following example, we will demonstrate how to compress a matrix, i.e. aggregating certain number of zones into one new zone and how to extract several zonal information out.
These two tasks can be done in Matrix program using RENUMBER keyword.
- Compress Matrix
Say we have an OD matrix below:
Now we want to aggregate zone 1 and zone 2 into one NEW zone as 1 and zone 3 as a new zone as 2, the mapping is the following:
By using RENUMBER, we can get the aggregated new matrix:
For the detailed script, please check MATRIX 1 in the attached sample catalog.
- Extract Matrix
Next, we want to extract the original 3-by-3 matrix into 2-by-2 matrix but we are only interested in zone 1 and zone 3 values, i.e. the target matrix is the following:
Check how this can be done in MATRIX 2 in the attached sample catalog.
Note: please check how we defined the mapping files for RENUMBER in the above two cases. You can find more information in the Cube Help Document.
renumberMatrix.rar (7.8 KB)