pub struct SearchSession<'eg, Cfg: EGraphConfig, L: LitVal, const T: bool, const P: bool>{ /* private fields */ }Expand description
A search session owns the search-space layer, term pool, best-result table,
action cache, and the MCGS statistics overlay. It provides one coherent
mark()/restore(token) that snapshots and rolls back all layers together.
The e-graph snapshot is borrowed immutably for the session’s lifetime; later
e-graph mutations are not observed (§4.1).
Implementations§
Source§impl<'eg, Cfg: EGraphConfig, L: LitVal, const T: bool, const P: bool> SearchSession<'eg, Cfg, L, T, P>
impl<'eg, Cfg: EGraphConfig, L: LitVal, const T: bool, const P: bool> SearchSession<'eg, Cfg, L, T, P>
Sourcepub fn new(
snap: &'eg AuSnapshot<'eg, Cfg, L, T, P>,
cycle_mode: CycleMode,
) -> Self
pub fn new( snap: &'eg AuSnapshot<'eg, Cfg, L, T, P>, cycle_mode: CycleMode, ) -> Self
Create a new session from a snapshot. The snapshot must outlive the session.
Sourcepub fn mark(&mut self) -> SearchToken
pub fn mark(&mut self) -> SearchToken
Snapshot the entire search state. Returns one opaque token; component tokens are not accessible. Layers are marked in dependency order.
Sourcepub fn restore(&mut self, token: SearchToken)
pub fn restore(&mut self, token: SearchToken)
Restore the entire search state to a previous mark. Two-phase: every component token is validated against its container and branch genealogy BEFORE any layer is mutated, so a foreign or abandoned token cannot cause a partial restore. Then restores in reverse dependency order (statistics first, then results/terms, then structure).
Sourcepub fn run_exact_warm(
&mut self,
left: Cfg::G,
right: Cfg::G,
pruning: bool,
subsumption: bool,
deadline: Option<Duration>,
) -> Result<(TermOf<Cfg>, Completion), AuError>
pub fn run_exact_warm( &mut self, left: Cfg::G, right: Cfg::G, pruning: bool, subsumption: bool, deadline: Option<Duration>, ) -> Result<(TermOf<Cfg>, Completion), AuError>
Exact solve of the root pair on this session’s persistent layers:
terms intern into the session pool, and the solve warm-starts from the
session’s stored incumbent for the pair. The session’s cycle mode
chooses side-context Exact or ordered-pair fixed-point Exact.
deadline makes the solve anytime.
Sourcepub fn run_uct(
&mut self,
left: Cfg::G,
right: Cfg::G,
config: &McgsConfig,
) -> Result<(TermOf<Cfg>, Completion), AuError>
pub fn run_uct( &mut self, left: Cfg::G, right: Cfg::G, config: &McgsConfig, ) -> Result<(TermOf<Cfg>, Completion), AuError>
Run MCGS on this session’s persistent layers. Statistics, search space,
terms, and results accumulate across calls and roll back with
restore(token).
Errors with AuError::CycleModeMismatch if config.cycle_mode differs
from the mode this session’s search space was created with: cycle
contexts already interned under one mode cannot be reused under the
other, and silently ignoring the requested mode would be worse.
Sourcepub fn hybrid_stats(&self) -> HybridStats
pub fn hybrid_stats(&self) -> HybridStats
What McgsConfig::hybrid_exact did, cumulative over every run_uct
call on this session.
Sourcepub fn pool_quality(&self, term: TermOf<Cfg>) -> (u32, u32)
pub fn pool_quality(&self, term: TermOf<Cfg>) -> (u32, u32)
The lexicographic quality of a term in this session’s pool.
Sourcepub fn snapshot(&self) -> &AuSnapshot<'eg, Cfg, L, T, P>
pub fn snapshot(&self) -> &AuSnapshot<'eg, Cfg, L, T, P>
The snapshot this session was built from.