Engine

On the map, Engine is one box. In the code, it is a group of parts with separate roles. Their joint input is a run manifest, the full specification of a run. Their joint output is the results of the run and a receipt. The box on the map has the line "Same inputs, same result". The mechanisms and the tests behind that line are under "Guarantees and their checks" on this page.

The parts of the engine

Part Role
The interpreter The interpreter of a compiled scenario. In it, a run manifest is checked, and its models are run one at a time in the manifest's order.
The model executor The code for a single operation of a run: one method of one model, with validated inputs and a typed result.
The vehicle runtime The Python layer for simulated vehicles and other agents. In it, a world of roads and vehicles is built from a declared network and a seed, advanced tick by tick, recorded for a replay and saved as states.
The Rust core The compiled program under the vehicle runtime: the queues on every road link, the route searches, the loop over the ticks and the checks after every tick.

Inputs

  • A run manifest from the compiler: the models in execution order, each with its exact method and its validated input, and the seed of the run.
  • The data of the run. A dataset is named by its identifier, its version and the SHA-256 digest of its bytes.
  • The account of the run. Every run belongs to one person in one workspace.
  • For a traffic run: a road network, the trips of the vehicles, a schedule of road events such as closures, the signal plans, the seed, the number of ticks and the moments for saved states.

Outputs

  • A typed result for each model, stored with a SHA-256 digest of its content.
  • A run receipt. It has the manifest's hash, the name of the seed rule, and for each model the seed, a hash of the exact parameters, the identifier and the digest of the result, and a status. The receipt has a hash of its own content.
  • For a traffic run: the number of ticks, a digest of the final state, the saved states, the saved frames of the replay, and the provenance of the run. The provenance has a digest of the starting state, the data sources, and the identity of the compiled core: its version and the SHA-256 digest of its binary.
  • After a failure, a receipt with the failed model under the status "failed" and each later model under the status "not reached".

Guarantees and their checks

The three conditions of a repeatable run are a fixed specification, fixed data and fixed random numbers. Each of the three has a mechanism, and each mechanism has a test.

Guarantee Mechanism Check
The manifest of a run is the compiled one. Before the first model, the manifest's hash is computed again, and its source specification is compiled a second time against the current registry. After a difference, the run is refused before any computation. In tests, a manifest with a changed field and a manifest with a new hash over changed content are each refused before the first model.
The data of a run are the named data. Before use, the bytes of each dataset are compared with the size and the SHA-256 digest in the dataset's reference. In a test, a dataset with different bytes, another version, another size or a failed status is refused with a typed error.
Each model has a seed of its own, independent of the order of the models. The seed of a model is a 48-bit number from the SHA-256 digest of the run's seed and the model's identifier. The name of the rule is in every receipt. In a test, a second derivation has the same seed, and a different identifier and a different run seed each have a seed of their own.
Two runs of one seeded scenario have equal results. The first three mechanisms of this table together. In a test along the whole path from compilation to stored results, a scenario of random removals on a network is run twice with one seed and once with a second seed. The two results with the first seed are equal, and the third result is different.
A traffic run is repeatable from its network, trips, seed and settings. The core has one random-number generator. Its first state is the declared seed, and its current state is part of every saved state. Route searches in parallel threads are applied in one fixed order. In tests of the core, a run on one thread and a run on several threads have the same routes and the same route history. The exported state of a reference run has a recorded SHA-256 digest. A run from a saved state and the uninterrupted run have equal bytes after every tick.
A continuation has a verified start. Before a continuation, the source run is replayed from its setup. A continuation is accepted when the replay has the tick count, the vehicle count and the final digest of the source run. In a test through an AI assistant's operations, a run in two parts and the same run in one piece have the same final digest and the same saved frames.
A failure is on the receipt. A run is stopped at its first failed model. In a test, a run with a failing model has that model under "failed" and each later model under "not reached".
The traffic state is checked after every tick. The count of vehicles and the capacity of each road link are compared with the state of the queues. The number of violations is part of the run's health status. Tests of the checker in the core.

Place in the path of a question

  1. In the compiler, the approved setup becomes a run manifest.
  2. In the engine, each step of the run is computed with the models and the data of the question.
  3. The results and the receipt are written to the record of the run.
  4. On an AI assistant's path, each result then has a label under the claim rules. The engine and the models are the same on all three paths into the platform.
  5. A saved state of a traffic run can be the start of a new run.