Skip to main content

SimulationAuditLog

Trait SimulationAuditLog 

Source
pub trait SimulationAuditLog {
    type StateSnapshot: Clone + Serialize + for<'de> Deserialize<'de>;

    // Required methods
    fn log_step(&mut self, entry: StepEntry<Self::StateSnapshot>);
    fn audit_log(&self) -> &[StepEntry<Self::StateSnapshot>];
    fn audit_log_mut(&mut self) -> &mut Vec<StepEntry<Self::StateSnapshot>>;
    fn clear_audit_log(&mut self);

    // Provided methods
    fn export_audit_json(&self) -> SimResult<String> { ... }
    fn export_audit_json_compact(&self) -> SimResult<String> { ... }
    fn generate_test_cases(&self) -> Vec<GeneratedTestCase> { ... }
    fn total_equation_evals(&self) -> usize { ... }
    fn total_decisions(&self) -> usize { ... }
    fn verify_all_equations(&self, tolerance: f64) -> Vec<(u64, String, f64)> { ... }
}
Expand description

MANDATORY trait for all EDD simulations (EDD-16, EDD-17, EDD-18).

Every simulation MUST implement this trait to produce a complete audit trail of every step.

Required Associated Types§

Source

type StateSnapshot: Clone + Serialize + for<'de> Deserialize<'de>

State snapshot type (must be serializable and cloneable)

Required Methods§

Source

fn log_step(&mut self, entry: StepEntry<Self::StateSnapshot>)

Record a step with full state capture.

Source

fn audit_log(&self) -> &[StepEntry<Self::StateSnapshot>]

Get all logged entries.

Source

fn audit_log_mut(&mut self) -> &mut Vec<StepEntry<Self::StateSnapshot>>

Get mutable access to audit log.

Source

fn clear_audit_log(&mut self)

Clear the audit log.

Provided Methods§

Source

fn export_audit_json(&self) -> SimResult<String>

Export log as JSON for analysis.

§Errors

Returns error if serialization fails.

Source

fn export_audit_json_compact(&self) -> SimResult<String>

Export log as compact JSON (no pretty printing).

§Errors

Returns error if serialization fails.

Source

fn generate_test_cases(&self) -> Vec<GeneratedTestCase>

Generate test cases from audit log (EDD-18).

Source

fn total_equation_evals(&self) -> usize

Get total number of equation evaluations in log.

Source

fn total_decisions(&self) -> usize

Get total number of decisions in log.

Source

fn verify_all_equations(&self, tolerance: f64) -> Vec<(u64, String, f64)>

Verify all equation evaluations are correct within tolerance.

Implementors§