Skip to main content

Module effect_handlers

Module effect_handlers 

Source
Expand description

Fugue Handlers and operation hooks for evolutionary operators

This module contains two distinct kinds of type:

  1. Genuine [fugue::Handler] implementations (TraceScoringHandler, RecordingHandler). These implement Fugue’s real effect-handler contract (on_sample_*log_prior, on_observe_*log_likelihood, on_factorlog_factors, finish → [Trace]) and can therefore be driven with [fugue::runtime::handler::run] to score or replay a model with correct log-weight bookkeeping. TraceScoringHandler is the handler that crate::inference::model::EvolutionModel uses to inject factor(β·f(x)) into a genome’s trace.

  2. Operation hooks (LoggingHook, RateLimitingHook, ConditionalHook, …). These are not Fugue handlers — they are plain before/after callbacks used to observe, log, or rate-limit the trace-based genetic operators in super::trace_operators. They do not participate in probabilistic scoring; the probability mass of an operator result is obtained by scoring it with TraceScoringHandler (or with crate::inference::model::EvolutionModel::to_weighted_trace).

Structs§

ComposedCrossoverHook
Composition of multiple crossover hooks
ComposedMutationHook
Composition of multiple mutation hooks
ConditionalHook
A hook that conditionally blocks operations based on a predicate
CrossoverRecord
Record of a crossover operation
LoggingHook
A hook that logs all evolutionary operations
MutationRecord
Record of a mutation operation
OperationStatistics
Statistics computed from hook records
RateLimitingHook
A hook that rate-limits operations
RecordingHandler
A genuine [fugue::Handler] that records the sequence of sampled sites while delegating all effect handling (and therefore all log-weight bookkeeping) to an inner handler.
SelectionRecord
Record of a selection operation
TraceScoringHandler
A genuine [fugue::Handler] that scores a fixed trace of choices.

Traits§

CrossoverHook
Operation hook for the trace-based crossover operator.
MutationHook
Operation hook for the trace-based mutation operator.
SelectionHook
Operation hook for a selection operator.

Functions§

hooked_crossover_traces
Hooked crossover operator that integrates with operation hooks.
hooked_mutate_trace
Hooked mutation operator that integrates with operation hooks.