Skip to content

prasadtalasila/TransportScheduler

Repository files navigation

TransportScheduler

Build Status Coverage Status Code Climate License: GPL v3

TransportScheduler is an interactive journey planner service. TransportScheduler takes the timetables of public transit operators. Users can send itinirary search queries and receive a list of feasible itineraries as a response. The system has been tested on the timetables of the public transit networks of India.

We summarized the theoretical techniques used for building this software in a technical report.

Usage

Installation

Please follow the installation instructions to get the required Erlang + Elixir run-time environment. We also have a Vagrant-based setup that follows GitHub's scripting principles for its operation. Please see script directory for relevant information.

Application Setup

Once installation is complete, you can proceed with compilation and testing of the TransportScheduler application.

git clone https://github.com/prasadtalasila/TransportScheduler.git
cd TransportScheduler
mix deps.get
mix compile
mix test

Run the following command to build a release, and copy data directory into build path:

mix release
cp -r data/ _build/dev/rel/ts

Run the following command to run the application interactively:

_build/dev/rel/ts/bin/ts console

Issue the following cURL command (in a separate terminal) for initialisation of the network:

curl http://localhost:8880/api

Other cURL commands to query the network (as mentioned in 'Testing') can now be issued.

To stop the Erlang runtime and exit the TS console:

System.halt

Testing

For testing the API, following cURL commands are issued to:

  1. Obtain Schedule of a Station:
curl -X GET 'http://localhost:8880/api/station/schedule?station_code=%STATION_CODE%&date=%DATE%'

where %STATION_CODE% is a positive integer indicating the station code of the source and %DATE% is the date of travel in the format 'dd-mm-yyyy'.

  1. Obtain State of a Station:
curl -X GET 'http://localhost:8880/api/station/state?station_code=%STATION_CODE%'

where %STATION_CODE% is a positive integer indicating the required station code.

  1. Obtain Travel Itinerary:
curl -X GET 'http://localhost:8880/api/search?source=%SOURCE%&destination=%DESTINATION%&start_time=%START_TIME%&end_time=%END_TIME%&date=%DATE%'

where %SOURCE% and %DESTINATION% are positive integers indicating the station codes of the source and destination respectively, %START_TIME% and %END_TIME% are non-negative integers indicating start and end times of the itinerary in seconds from 12 am, and %DATE% is the date of travel in the format 'dd-mm-yyyy'.

Deployment

Run the following commands to deploy (currently server and user are localhost): UNTESTED

mix edeliver build release
mix edeliver deploy release

Run the following command to start application: UNTESTED

mix edeliver start
cp -r data/ /home/$USER/test/ts

Benchmark Tests

For running the respective benchmarks (async/synchronous), use

mix sync_benchmark
mix async_benchmark

A shell script for running the synchronous benchmark multiple times is:

for i in $(seq 1 $n); do mix benchmark [2>/dev/null | grep -C 2 "^Start time: "]; done [> ~/file.out]

where $n is the number of random queries over which the benchmark must be run. file.out is the file that will store the log thus generated by the benchmark. The portion of the command in [square brackets] is optional.

Automatically, three files async_test.csv, sync_test.csv and times.csv are created in the data/ directory.

About

concurrent implementation of CSA algorithm using cell model

Resources

License

Stars

Watchers

Forks

Packages

No packages published