The settings file and the run record#
Two files in the format TOML 1.0, with fixed names, share one layout.
File |
Written by |
Read by |
What it holds |
|---|---|---|---|
|
the user (or the experimental |
The window, the parameters, the input files and the classes of a run. |
|
|
every run, beside its four tables |
|
Part one: the settings the run ran with, every default filled in. Part two, from |
Part one of a record is a settings file. Every line of a record before [result], copied into a run.toml, runs
the same run again, provided every input of the run was read from a file. A run never writes run.toml, so settings
and results may share a folder. How to use the two files is in Settings and
Reproducing a run.
All tables of keys on this page share one layout: Key, Type (the TOML type), Unit, In run.toml
(required, or what its absence means) and Meaning. In a record every key of part one that applies is written.
A minimal settings file#
The window, the files and the classes are enough: every parameter left out takes its default. This file, put in place
of the run.toml of the case dotnet (in a copy of its folder named minimal), runs the case:
window_start_s = 27000
window_end_s = 34200
[network]
nodes_file = "nodes.parquet"
links_file = "links.parquet"
[demand]
trips_file = "trips.parquet"
classes = ["bike_only", "car_and_bike", "car_only", "no_vehicle"]
[transit]
gtfs_file = "gtfs.zip"
import tomllib
import openmobisim as oms
run = oms.run_file("minimal", out="minimal-run")
with open(run.record, "rb") as file:
record = tomllib.load(file)
print(sorted(record))
print(record["parameters"]["bike_speed"], record["parameters"]["link_bin"])
print(record["network"])
print(record["result"]["iterations"], record["result"]["stopped_by_rule"])
print(record["result"]["network"])
['demand', 'format', 'network', 'parameters', 'result', 'transit', 'window_end_s', 'window_start_s']
15.0 300
{'nodes_file': '../minimal/nodes.parquet', 'links_file': '../minimal/links.parquet'}
17 True
{'source': 'tables', 'nodes': 41, 'links': 408, 'fingerprint': '396cdc682fcf83a4'}
The record of this run holds every parameter at its default, and the input files by their paths relative to the record’s folder.
Part one: the settings#
The top of the file#
Key |
Type |
Unit |
In |
Meaning |
|---|---|---|---|---|
|
integer |
none |
may be absent |
The format of the file. Only 1 is read. |
|
integer |
s after midnight |
required |
The start of the period simulated, a second of the clock. |
|
integer |
s after midnight |
required |
The end of the period simulated, as given. When it is not a whole number of |
A record starts with one comment line that says what the file is and how its two parts divide.
[parameters]#
One key per parameter of Parameters, by its name, which gives each one’s default, source and
meaning. In a settings file a key left out takes its default. In a record every parameter the run read is written at
the value it used, in this order, each followed by its unit as a comment (capacity_per_lane = 1800.0 # veh/h per lane). A key or table under [parameters] that is not in this table is refused by name.
Key |
Type |
Unit |
Given to |
|---|---|---|---|
|
float |
vehicles per hour per lane |
the network |
|
float |
km/h |
the network |
|
float |
km/h |
the network |
|
float |
m |
the demand; ignored with a warning in settings without |
|
float |
m |
the timetable; ignored with a warning in settings without |
|
integer |
s |
the run |
|
integer |
rides |
the run |
|
integer |
searches per trip end |
the run |
|
integer |
routes per origin-destination pair |
the run |
|
integer |
journeys per trip |
the run |
|
string |
name |
the run: |
|
float |
none |
the run |
|
float |
none |
the run |
|
integer |
iterations |
the run |
|
integer |
iterations |
the run |
|
integer |
s |
the run |
|
integer, 0 to 2⁶³ − 1 |
none |
the run |
|
one table per class |
see below |
the run |
The parameter osm_class_defaults is never written and is not a key: its one value is the OpenStreetMap reader’s own
table (Input tables and files).
The coefficients of a class#
One table per class, [parameters.coefficients."<class id>"], in class id order, with one key per column of the
choice row: sixteen floats. A coefficient is a cost, so a positive value is worse. In a settings file, the tables may
be left out altogether (every class then takes the defaults); when one is given, every class needs its table, and each table holds all
sixteen keys. As a keyword of run, coefficients is a dict from every class id to its sixteen numbers in the order of
this table. How the costs enter the choice is in Choice.
Key |
Unit |
Default |
Multiplies |
|---|---|---|---|
|
cost per minute |
0.1 |
The minutes of a car trip on the network. |
|
cost per minute |
0.1 |
The minutes of a bike trip on the network. |
|
cost per minute |
0.165 |
The minutes walked: the whole of a walk trip, and the walks between the doors and the network of a car or bike trip. |
|
cost per minute |
0.1 |
The minutes in transit vehicles. |
|
cost per minute |
0.165 |
The minutes of the walk from the door to the first stop. |
|
cost per minute |
0.165 |
The minutes of the walk from the last stop to the door. |
|
cost per minute |
0.145 |
The minutes from the end of the access walk to the first boarding. |
|
cost per minute |
0.145 |
The minutes waited at the later boardings. |
|
cost per minute |
0.165 |
The minutes walked between two rides. |
|
cost per transfer |
0.5 |
The number of transfers. |
|
cost per euro |
0.6 |
The money paid, in euros (money is 0 for every alternative). |
|
cost per unit of the logarithm of the path size |
−1 |
The logarithm of a car route’s path size. Recorded as given; the logit reads it times |
|
cost per car alternative |
0 |
1 for a car alternative: the constant of the mode. |
|
cost per bike alternative |
0 |
1 for a bike alternative. |
|
cost per walk alternative |
0.5 |
1 for a walk alternative. |
|
cost per transit alternative |
0.25 |
1 for a transit alternative. |
With a timetable, a class whose coefficient of a transit time or of the transfers is negative or not finite is refused.
[network]#
Either an OpenStreetMap extract or the two tables; a settings file with both is refused.
Key |
Type |
Unit |
In |
Meaning |
|---|---|---|---|---|
|
string |
none |
this, or the two table files |
The path of an OpenStreetMap extract, read by |
|
array of four floats, or array of pairs of floats |
degree (WGS84) |
absent: the whole extract |
The region the extract is cut to: |
|
string |
none |
absent: cars on every car road |
|
|
string |
none |
with |
The path of the nodes table, a Parquet file. |
|
string |
none |
with |
The path of the links table, a Parquet file. |
[demand]#
Key |
Type |
Unit |
In |
Meaning |
|---|---|---|---|---|
|
string |
none |
required |
The path of the trips table, a Parquet file. |
|
array of strings |
none |
required |
The ids of the traveller classes. In a record they are in id order. |
[transit]#
The table is absent for a run without transit.
Key |
Type |
Unit |
In |
Meaning |
|---|---|---|---|---|
|
string |
none |
required when |
The path of the GTFS feed, a |
The paths of the input files#
File |
A path is read or written as |
|---|---|
|
Joined to the folder of the settings file. A relative path is relative to that folder. |
|
Written relative to the folder of the record, with |
So a record’s folder and its inputs move together, and a run written into a folder at the same depth records the
same paths. An input given in memory has no key in the record: the record’s [network] or [demand] then names no
file, such a run cannot be run again from its record, and Run.open needs the input passed.
Part two: [result]#
[result]#
Part two starts with a comment line, # Part two: what the run found and did.
Key |
Type |
Unit |
Meaning |
|---|---|---|---|
|
string |
none |
The version of the package that ran. |
|
integer |
s after midnight |
The end of the window the run used: |
|
integer |
iterations |
The number of iterations run: the rows of |
|
boolean |
none |
|
[result.repairs]#
What the run set right about its window, one integer per kind of repair: its count. The table is written only when a
repair of its kind was made. Its keys are window_end_moved, trips_outside_window, modes_after_window and
trips_after_window (Repairs).
[result.network]#
Key |
Type |
Unit |
Meaning |
|---|---|---|---|
|
string |
none |
|
|
integer |
nodes |
The nodes of the network. |
|
integer |
links |
The links of the network, of all modes. |
|
string |
none |
The network’s fingerprint, 16 lower-case hexadecimal digits (below). |
[result.network.osm_report], absent for a network from tables, holds the five counts of the OpenStreetMap reader,
which are also Run.osm_report:
Key |
Type |
Unit |
Meaning |
|---|---|---|---|
|
integer |
nodes |
The nodes of the network. |
|
integer |
links |
The links of the three layers (car, bike, walk). |
|
integer |
links |
The links dropped outside their layer’s largest strongly connected part, counted before contraction. |
|
integer |
pieces |
The pieces of ways that start and end at one node, dropped. |
|
integer |
ways |
The street ways that hold some of their nodes and miss others: cut by the edge of the extract or of the region, or at a node that cannot be placed. |
[result.network.repairs]: each kind of repair the network’s readers made, with its count; written only when there
is one (Repairs).
[result.demand]#
Key |
Type |
Unit |
Meaning |
|---|---|---|---|
|
integer |
trips |
The trips of the demand. |
|
integer |
rows |
The rows of the trips table. Written only when it differs from |
|
string |
none |
The demand’s fingerprint. |
[result.demand.repairs]: each kind of repair the demand’s readers made, with its count; written only when there is
one.
[result.transit]#
Absent for a run without transit.
Key |
Type |
Unit |
Meaning |
|---|---|---|---|
|
integer |
stops |
The stops of the timetable. |
|
integer |
runs |
The runs of the timetable. A run is one vehicle’s journey along its calls on the service day. |
|
string |
none |
The timetable’s fingerprint. |
[result.transit.gtfs_report] holds the fifteen counts of the GTFS reader, which are also Run.gtfs_report:
Key |
Type |
Unit |
Meaning |
|---|---|---|---|
|
integer |
none |
The service day read, as GTFS writes a date, |
|
integer |
trips |
The feed’s trips in service that day. |
|
integer |
runs |
The runs of the timetable. |
|
integer |
calls |
The calls of those runs at stops. |
|
integer |
runs |
The runs of the day before that continue past midnight, kept from midnight on. |
|
integer |
runs |
The runs made from |
|
integer |
stops |
The stops read. |
|
integer |
trips |
The trips dropped because their first or last call has no time. |
|
integer |
trips |
The trips dropped because they have one call. |
|
integer |
calls |
The calls without a time, interpolated between the timed calls around them. |
|
integer |
calls |
The calls with |
|
integer |
rows |
The rows of |
|
integer |
footpaths |
The footpaths derived between stops. |
|
integer |
rows |
The rows of |
|
integer |
rows |
The rows of |
[result.transit.repairs]: each kind of repair the GTFS reader made, with its count; written only when there is one.
Fingerprints#
A fingerprint is the 64-bit FNV-1a hash of what the network, the demand or the timetable was built from, written as 16 lower-case hexadecimal digits. It is not a cryptographic hash. The same rows in any order give the same fingerprint; a change to any value that is fed changes it.
Fingerprint |
Fed |
Not fed |
|---|---|---|
network |
The projection; the bike and walk speeds; each node’s id, position in metres and signal mark; each link’s id, two nodes, length, lanes, modes, car free-flow speed, capacity and signal mark |
The links’ shapes and road classes; a |
demand |
The class ids; each trip’s id, class, departure, modes and two positions in metres in the network’s plane |
The joins to nodes and stops, which follow from the network, the timetable and |
timetable |
Each stop’s id and position; each run’s id and calls (stop, arrival, departure); each footpath’s two stops and seconds |
The names of stops and lines |
How fingerprints tell whether two runs had the same inputs is in Reproducibility.
What is not in a record#
No time stamp, no machine name, no thread count: a second write of the same run, and a run at any number of threads,
give the same bytes. TOML has no null: a value that does not exist is an absent key or table. A float is written in
its shortest form that reads back as the same number, with a point or an exponent (1800.0, 0.1, 1e-7).
What run_file and Run.open read#
|
|
|
|---|---|---|
|
only 1; may be absent |
as |
The window |
|
|
|
every key; an absent one takes its default; a key it never holds is refused |
|
|
the input files, built by |
the same files, by the same function, for each input not passed |
|
not read. A whole record renamed |
|
Fingerprints |
a settings file holds none. For a whole record renamed |
each input, passed or rebuilt, is compared with the record’s; a difference is named in one |
A key or table the file never holds, outside |
ignored, all of them named in one |
ignored, all of them named in one |
run_file checks the keys, the window, the files, the classes and the booleans before any input is built; each
parameter’s value is checked by the entry point that reads it. run_file writes the record of the run it ran, with
the fingerprints of the inputs as they are now.