Commit Graph

3 Commits

Author SHA1 Message Date
fe6f028127 feat(api): promote Factor/Schedule/VarStore to pub in factors module
Exposes the factor-graph machinery so power users can define custom
factors and schedules (see Game::custom in the next task). The
internal factor/ and schedule/ modules remain unchanged (still
referenced by Game's internals via crate::factor); the user-facing
public API goes through the new factors module re-exports:

  pub use crate::factor::{BuiltinFactor, Factor, VarId, VarStore};
  pub use crate::factor::rank_diff::RankDiffFactor;
  pub use crate::factor::team_sum::TeamSumFactor;
  pub use crate::factor::trunc::TruncFactor;
  pub use crate::schedule::{EpsilonOrMax, Schedule, ScheduleReport};

#[allow(dead_code)] guards on the previously-pub(crate) items are
removed because the types are now referenced via the re-exports.

Promotes public methods on VarStore (len, alloc, get, set, clear, new)
and adds is_empty per clippy lint. Keeps marginals field private as an
implementation detail — users access via the public methods.

Part of T2 of docs/superpowers/specs/2026-04-23-trueskill-engine-redesign-design.md.
2026-04-24 12:50:37 +02:00
54e46bef59 feat(factor): implement TruncFactor with cached evidence
EP truncation factor that operates on a diff variable. Stores its
outgoing message so the cavity computation produces the correct EP
message on each propagation. The first propagation caches the
evidence contribution (cdf-bounded probability) for log_evidence().

Promotes lib::cdf to pub(crate) so the factor can use it.
2026-04-24 08:22:06 +02:00
ebccc7b454 feat(factor): introduce Factor trait and BuiltinFactor enum
Adds the trait that all factors implement and the enum dispatcher
used by the schedule to drive heterogeneous factors without dynamic
dispatch in the hot loop.

The three built-in factors (TeamSum, RankDiff, Trunc) are stubbed
out; concrete implementations follow in tasks 4-6.
2026-04-24 08:14:00 +02:00