Skip to main content

Module problem

Module problem 

Source
Expand description

Problem — the declarative, content-addressable description of an SA campaign’s input space. Vector of factors, each with a name, distribution, and kind (continuous / discrete / categorical / boolean).

§The construction discipline

Problem is #[non_exhaustive]; only ProblemBuilder::build produces Problem values. External callers cannot construct via struct literal, cannot use Default-then-mutate, cannot reach around the builder’s parameter validation. Every Problem value reachable across crate boundaries has been validated at build time.

§Content-addressing

Problem::content_hash() -> [u8; 32] returns SHA-256 over the canonical-JSON serialization of the Problem. Stable across calls; content-equivalent Problems hash equally; semantically distinct Problems hash distinctly. The hash serves as a content-identifier for “which Problem produced this result?”

Blake3 deferred to a follow-on PR — Problem JSON is small (factor descriptions, not sample matrices); SHA-256 suffices.

Structs§

Factor
A single factor in the experiment. Name + distribution + kind. #[non_exhaustive] blocks struct-literal construction outside this crate; consumers go through ProblemBuilder.
Group
A named group of factors treated as a single unit in SA.
Problem
The declarative input-space description for an SA campaign.
ProblemBuilder
Builder for Problem. The only public path to a Problem value.

Enums§

BuildError
Errors arising from ProblemBuilder::build.
FactorKind
The role a factor plays in the experiment. Closed enum, #[non_exhaustive]. Continuous is the default for typical SA applications.