Preprocessing Code

The code takes the input files, preprocesses them and generates keys which are entered into up and down.csv files. It also creates the dictionaries and tuples for heaadway, frequency, symmetric and other events.

preprocess.downwrite(l, demand, sdown, f, sdown1)[source]

Function writes lines in down.csv file. Apart from this this function also creates some lists using which lists of services for different types of constraints are created in other functions such as headway,frequency etc.

preprocess.dwell()[source]

Function creates set containing arrival events of services between which dwell time will be specified

preprocess.frequency(frequp, freqdown, fup_arr, fdown_arr)[source]

Function creates symmetry constraints among services plying between same origin-destination pairs.Therfore lists containing keys among which symmetry/frequency constraints are to be defined are made by this function

preprocess.graph()[source]

The first function to be called and takes Edge, Stations and OD as input files. It generates the network and calls the function headers and keys.

preprocess.headers(station_name)[source]

Writes header titles for the files up.csv and down.csv

preprocess.headway(infoup, infodown)[source]

Function creates the services between which headway constraints are to be defined If services have same two consecutive stations headways are to be put between the departure times of these services.

preprocess.keys(src, demand, des, gph, station_number)[source]

Function generates keys to be written in the up and down.csv files and creates all the constraint dictionaries by calling the other functions

Function creates two dictionaries, one for upside other for downside

preprocess.traversal(tau, tdu, tad, tdd)[source]

Function creates traversal constraints between two consecutive stations. Four dicts are created to hold the arrival and departure time of up and down trains. The traversal time is stored in dict called odtrav

preprocess.turnaround()[source]

Function creates two dictionaries with arrival and departure events at each terminal station. These lists will be used along with the platform availability at these stations to decide linking of arrival and departure events.

preprocess.updown(l)[source]

Written by anurag for panvel-andheri services

preprocess.upwrite(l, demand, sup, f, sup1)[source]

Function writes lines in up.csv file. Apart from this this function also creates some lists using which lists of services for different types of constraints are created in other functions such as headway,frequency etc.