Module id
Expand description
Identifier newtypes.
Every identifier is a distinct type so that a trial identifier can never be
passed where a study identifier is expected, and — the case that actually
matters for determinism — so that TrialId and TrialNumber cannot be
confused:
| Type | Scope | Allocation | Used for |
|---|---|---|---|
TrialId | storage-global | opaque, may have gaps, order unspecified | addressing a trial |
TrialNumber | per study | contiguous from 0, race-safe | seeding and ordering |
Sampling is keyed on the number, never on the id (the determinism
contract):
the parameters of trial number
n are a pure function of (study_seed, n, space) for stateless samplers,
which is what makes a multithreaded study reproduce a single-threaded one.
An id, by contrast, is whatever the backend handed out and may depend on
how many other studies exist in the same storage.
Structs§
- StudyId
- Identifies a study within one storage backend.
- TrialId
- Identifies a trial within one storage backend.
- Trial
Number - The position of a trial within its study: contiguous, starting at 0.
- Worker
Id - Identifies a worker (thread, process or remote client) in a study.