Skip to main content

Module id

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:

TypeScopeAllocationUsed for
TrialIdstorage-globalopaque, may have gaps, order unspecifiedaddressing a trial
TrialNumberper studycontiguous from 0, race-safeseeding 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.
TrialNumber
The position of a trial within its study: contiguous, starting at 0.
WorkerId
Identifies a worker (thread, process or remote client) in a study.