Skip to main content

TraceGenome

Trait TraceGenome 

Source
pub trait TraceGenome: EvolutionaryGenome {
    // Required methods
    fn to_trace(&self) -> Trace;
    fn from_trace(trace: &Trace) -> Result<Self, GenomeError>;

    // Provided method
    fn trace_prefix() -> &'static str { ... }
}
Expand description

Extension trait: genomes that can be encoded as fugue traces.

Implementing this trait is what admits a genome to the ppl inference layer. The classic algorithms never require it.

Required Methods§

Source

fn to_trace(&self) -> Trace

Convert genome to a fugue trace.

Each gene is stored at an indexed address (e.g., gene#0, gene#1, …) as a pure value; stored log-probabilities are zero. Score the trace under a prior model to obtain real probability mass.

Source

fn from_trace(trace: &Trace) -> Result<Self, GenomeError>

Reconstruct genome from a fugue trace.

This is the inverse of Self::to_trace, extracting gene values from the trace’s choice map.

Provided Methods§

Source

fn trace_prefix() -> &'static str

Get the address prefix used for trace storage (default: "gene").

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl TraceGenome for BitString

Available on crate feature ppl only.
Source§

impl TraceGenome for DynamicRealVector

Available on crate feature ppl only.
Source§

impl TraceGenome for Permutation

Available on crate feature ppl only.
Source§

impl TraceGenome for RealVector

Available on crate feature ppl only.
Source§

impl<A, B> TraceGenome for CompositeGenome<A, B>
where A: TraceGenome + Clone + Send + Sync + Serialize + for<'de> Deserialize<'de>, B: TraceGenome + Clone + Send + Sync + Serialize + for<'de> Deserialize<'de>,

Available on crate feature ppl only.
Source§

impl<T: Terminal, F: Function> TraceGenome for TreeGenome<T, F>

Available on crate feature ppl only.