Skip to main content

Module decision_core

Module decision_core 

Source
Expand description

Generic expected-loss decision framework (bd-2uv9c, bd-3rss7).

DecisionCore<S, A> is the universal trait that unifies all Bayesian decision points in FrankenTUI. Each adaptive controller (diff strategy, resize coalescing, frame budget, degradation, VOI sampling, hint ranking, palette scoring) implements this trait with domain-specific state and action types.

§Decision Rule

The framework follows the expected-loss minimization paradigm:

a* = argmin_a  E_{s ~ posterior(evidence)} [ loss(a, s) ]

Every decision produces an EvidenceEntry that records the posterior, evidence terms, action chosen, and loss avoided — enabling post-hoc audit via the UnifiedEvidenceLedger.

§Calibration

After each decision, the actual outcome is observed and fed back via DecisionCore::calibrate. This closes the feedback loop, updating the posterior for the next decision.

§Fallback Safety

Every DecisionCore implementation must provide a safe fallback action via DecisionCore::fallback_action. When the posterior is degenerate or computation fails, the framework returns this action rather than panicking.

Structs§

Decision
Result of a decision: the chosen action plus evidence for the ledger.
Posterior
Posterior belief over the state space.

Traits§

Action
Marker trait for an action space element.
DecisionCore
The universal decision-making trait.
Outcome
Observed outcome after a decision was executed.
State
Marker trait for a state space element.

Functions§

argmin_expected_loss
Compute the expected-loss-minimizing action given a posterior and loss fn.
second_best_loss
Find the second-best loss (for computing loss_avoided).