Monte-Carlo family: McFamily over a seed set, analog to SweepFamily (C12 axis 4) #68
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
C12 axis 4: Monte-Carlo as a sweep over seeds. A Monte-Carlo run is
monte_carlo(blueprint, base_point, seeds)→ anMcFamilyanalog of SweepFamily — the same disjoint-parallelsweep_with_threadscore (aura-engine/src/sweep.rs), but the varying dimension is the seed (C12: MC = sweep over seeds), not a tuning param. Each realization is a disjoint C1 unit; parallelism is across realizations, never within one.Build
monte_carlo(...)entry returningMcFamily: the per-seed RunReports plus an aggregate (mean / median / quantiles of the chosen metric across realizations).Depends on
Acceptance
N seeds → N disjoint deterministic realizations; the family is reproducible (same seed set → same McFamily); the aggregate is a pure post-run reduction.
Contracts
C12 axis 4, C21 (family orchestration), C1 (each realization bit-identical).
Design constraint (World-II eager-agnostic firewall — refs #71)
The MC family API must NOT take or store a materialized per-draw
Vec<Stream>.monte_carlo(...)takesseeds: &[u64]+ a per-draw closureFn(u64, &[Scalar]) -> RunReport, andMcFamilyholds only the per-seedRunReports + the aggregate. Seed->source construction stays a closure-body concern (it builds aSourcethe way #66 wires it), so a later lazyHarness::runneeds noMcFamilyAPI break. Reusesweep_with_threads; do not fork the executor. Depends on #66 + #71.Design reconciliation (aggregate fork — settled for a future
specify)While scoping #68 in a
/bosssession,specifybounced at its preconditiongate on one unresolved load-bearing fork: the aggregate semantics. The
comment above pins
monte_carlo(seeds, closure)with no metric param, yet callsthe aggregate "mean/median/quantiles of the chosen metric" — the two cannot
both be honoured literally. Three candidates were weighed:
McAggregatecovers all three metrics (total_pips,max_drawdown,exposure_sign_flips), each with mean/median/quantiles at afixed set (p5/p25/p50/p75/p95). No metric param → honours the stated signature.
metric: &strparam, aggregate only the chosen metric (honours"chosen metric" but breaks the stated signature; discards the other two).
McFamilystores onlydraws; aggregate is a separatemc_aggregate(&family, metric)function (cleanest Registry analogy, butcontradicts the comment's literal "McFamily holds … the aggregate").
Decision: V1. Provenance: user (@Brummel) decided in the in-context design
discussion, 2026-06-15 — verbatim "ja, wir machen v1". Rationale that drove it:
the raw per-seed
drawsare retained in every variant, so custom statistics(custom quantiles, histograms, A/B distribution comparison) always read
drawsdirectly — V3 unlocks no capability the draws don't already give. The stored
aggregatefield is therefore pure convenience for the common case(robustness / tail-drawdown), costs nothing, and honours the literal signature.
Implementation deferred to a fresh session (user's choice). Depends on #66
(seed-as-input, landed: commit
c9f0e43) + #71 (Source seam, landed). Whenresumed: settled design →
specifydirect-entry, nobrainstormneeded.Landed in
e2c550f(monte_carlo family — McFamily over a seed set, V1 aggregate) and audited drift-clean in cycle 0043 (61a8436). Reuses the disjoint-parallel executor via a shared run_indexed core (behaviour-preserving sweep refactor); eager-agnostic API (seeds + per-draw closure, no materialized stream Vec). Closing.