Skip to content
Felix Gündling edited this page Oct 30, 2023 · 10 revisions

List of tools

Since version 0.5 MOTIS provides the following tools as sub commands. Before, they were separate binaries.

  • motis generate: Generate random routing requests
  • motis compare: Compare routing results
  • motis analyze: Prints routing statistics (timings, memory usage...)
  • motis print: Prints routing responses
  • motis xtract: Creates schedule subsets
  • motis rewrite: Changes the target of all messages in a file
  • gtfsrt-json2pb: Convert GTFS-RT JSON to protobuf
  • gtfsrt-pb2json: Convert GTFS-RT protobuf to JSON

Random routing query generation

Random queries between two stations can be generated using motis generate. Random queries between two geo coordinates can be generated using motis intermodal_generate. For usage information, invoke the tool using --help.

Example: Generate 100 random PreTrip queries between stations for the routing and csa module:

motis generate \
  --message_type routing \
  --start_type ontrip_station \
  --dest_type station \
  --routers /nigiri /routing

config.ini should include the basic dataset configuration (schedule location, date etc.).

Each file contains one query (JSON) per line and can be processed by MOTIS in batch mode. The same queries are generated for each target (in the same order and using the same message ids).

To create a new file for a different target but with the same routing queries, use motis rewrite, e.g.:

motis rewrite --in queries-fwd-routing.txt --out queries-fwd-csa_cpu.txt --target /csa/cpu

Display routing result

Routing results (including intermodal results) can be displayed in a human-readable format using motis print. Timestamps can be printed in UTC (-u / --utc) or local time (-l / --local).

Examples:

# print all connections in the file
motis print -l result.txt
# print all connections of the first result
head -n 1 results-fwd-routing.txt | motis print -l -

Compare routing results

To compare two routing responses (e.g. the results of two different routing algorithms for the same query), motis compare can be used. motis compare supports all routing results, including those without intermodal connections.

Example: You have generated random pretrip connections using motis generate (as described above), executed the queries in batch mode and want to compare the results generated by the routing and csa modules:

motis compare --queries q-fwd-routing.txt q-fwd-csa_cpu.txt --responses results-fwd-routing.txt results-fwd-csa_cpu.txt

For pretrip queries (forward or backward), use -t pretrip. For forward ontrip queries (station or train), use -t ontrip_fwd, and for backward ontrip queries -t ontrip_bwd.

This will compare all routing results in the specified files. Results are matched by message id. Differences between results are displayed and responses that don't match are written to an output directory (fail by default, see --fail) for further inspection.