Macro Model Documentation

I don't normally publish code, so this page is likely done differently than a typical documentation page. If you would like to try the code yourself, you can find it here. Ensure you can run C++ code before downloading! If you want to suggest improvements to the code, please contact me.

I will start working on a more user-friendly way of using the code after this page is published.

Assumptions

-Route 2 (the middle route) will always exist and be more frequent than the surrounding routes, to the point that all riders closest to it will prefer to take route 2 in all cases (this is presently true about the real-life 20 - Jane).
-All bus route coverage zones are rectangles and routes are parallel to each other in the study area.
-Perceived convenience is the only consideration when one is choosing a route.
-Users can walk in any way they choose to get to a bus route conveniently, and bus routes can be boarded from anywhere in the rectangle. To correct this one, you may increase all walking distances.
-No one will choose driving over transit if it is more convenient.

Inputs

The first line of input contains integers \(n\) and \(m\). \(n\) is the number of routes. For this program, \(n\) is always 3. I would like to improve this to allow for \(n = 2\) in the near future.
\(m\) is the total number of buses allotted. They will be distributed among the \(n\) routes.

The second line contains the \(minf[i]\) (minimum frequency) value for each route \(i\), in minutes. If not enough buses are allotted for all of the minimum frequencies to be met, the program will output an error message.

The third line contains the walking standances between each of the routes. The inputs are in metres, then multiplied by 0.022 to get the percieved time spent in minutes, according to the TTC .

The fourth line contains \(prop[i]\), the proportion of riders nearest to each route. The routes are assumed perfectly parallel and the areas perfectly rectangular in this scenario. The land use is assumed to have the same density of potential riders throughout. Put together, we assume the proportion of riders is roughly the same as the area and walking distances can be derived from the ideal parallel rectangles.

The fifth line contains the average walking distance \(wd[i]\) between route \(i\) and the median location on route \(i\), for all three routes.

The sixth line contains the amount of time (in minutes) each route takes for the average individual. Total time through the study area divided by 2 may be a good approximation for this. If all take the same amount of time, setting all three as 0 is valid and the code will work normally.

The seventh and final line contains the round trip time ("R.T.T.") of each route, including minimum layover time. This number is used to calculate headways from the number of buses given. The maximum round-trip time during a given time period should be used here.

Outputs

The output will be three lines, each describing the number of buses on and the headway of each route. If a route does not run, it will be noted in the output.




Last updated: 05/25/2026