pub struct EvolutionSMC;Expand description
The tempered-SMC evolution driver.
Implementations§
Source§impl EvolutionSMC
impl EvolutionSMC
Sourcepub fn run<P, L, R>(
rng: &mut R,
model: &EvolutionModel<P, L>,
cfg: EvoSmcConfig,
) -> EvolutionPosterior<P::Genome>
pub fn run<P, L, R>( rng: &mut R, model: &EvolutionModel<P, L>, cfg: EvoSmcConfig, ) -> EvolutionPosterior<P::Genome>
Run tempered SMC targeting the Boltzmann posterior
π ∝ p(x)·exp(f(x)) of model (β is supplied by fugue’s adaptive
tempering; model’s own β setting is ignored here by construction).
cfg.crossover builds a structure-safe SharedSiteCrossover kernel
(see CrossoverConfig for what it can and cannot exchange on a
variable-structure prior); None runs per-particle rejuvenation only.
Source§impl EvolutionSMC
impl EvolutionSMC
Sourcepub fn run_with_kernel<P, L, R, K>(
rng: &mut R,
model: &EvolutionModel<P, L>,
cfg: EvoSmcConfig,
kernel: &mut K,
) -> EvolutionPosterior<P::Genome>
pub fn run_with_kernel<P, L, R, K>( rng: &mut R, model: &EvolutionModel<P, L>, cfg: EvoSmcConfig, kernel: &mut K, ) -> EvolutionPosterior<P::Genome>
Like EvolutionSMC::run, but with an explicit population kernel
(e.g. a [fugue::CrossoverKernel] with a
subtree_crossover_mask for
grammar-driven tree genomes). cfg.crossover is ignored.
Source§impl EvolutionSMC
impl EvolutionSMC
Sourcepub fn anneal<P, L, R>(
rng: &mut R,
model: &EvolutionModel<P, L>,
cfg: EvoSmcConfig,
beta_max: f64,
anneal_steps: usize,
) -> EvolutionPosterior<P::Genome>
pub fn anneal<P, L, R>( rng: &mut R, model: &EvolutionModel<P, L>, cfg: EvoSmcConfig, beta_max: f64, anneal_steps: usize, ) -> EvolutionPosterior<P::Genome>
Optimizer mode: run tempered SMC to the posterior (β = 1), then
keep annealing the ladder toward beta_max, concentrating the
population on the maximizers of the likelihood/fitness.
The continuation is built from fugue’s exported primitives and keeps
every invariant of the tempering loop: at each rung the particles are
incrementally reweighted by Δβ·(log_likelihood + log_factors),
normalized, systematically resampled to uniform weights, and
rejuvenated with π_β-invariant MH (plus the structure-safe
SharedSiteCrossover sweep when cfg.crossover is set — see
CrossoverConfig; for a model-aware kernel such as
subtree_crossover_mask use
EvolutionSMC::anneal_with_kernel). The rung schedule is geometric
from 1 to beta_max over anneal_steps rungs.
The returned population approximates π_{β_max} ∝ p(x)·L(x)^{β_max},
which for large beta_max concentrates on the optima — a principled,
uncertainty-aware replacement for a classic GA on single-objective
problems. log_evidence reflects only the β ≤ 1 ladder (evidence is
defined at the posterior).
With rejuvenation_steps == 0 and no kernel nothing moves a particle
past β = 1: each rung only reweights and resamples, so the population
collapses onto duplicates of the fittest posterior particles. Keep at
least one rejuvenation step (or a kernel) when annealing.
Sourcepub fn anneal_with_kernel<P, L, R, K>(
rng: &mut R,
model: &EvolutionModel<P, L>,
cfg: EvoSmcConfig,
beta_max: f64,
anneal_steps: usize,
kernel: &mut K,
) -> EvolutionPosterior<P::Genome>
pub fn anneal_with_kernel<P, L, R, K>( rng: &mut R, model: &EvolutionModel<P, L>, cfg: EvoSmcConfig, beta_max: f64, anneal_steps: usize, kernel: &mut K, ) -> EvolutionPosterior<P::Genome>
Like EvolutionSMC::anneal, but with an explicit population kernel
applied both inside the β ≤ 1 ladder and at every annealing rung —
the optimizer-mode counterpart of EvolutionSMC::run_with_kernel
(e.g. a [fugue::CrossoverKernel] with a
subtree_crossover_mask to
anneal a grammar prior with subtree grafts). cfg.crossover is
ignored; pass [fugue::NoKernel] for rejuvenation only.
Auto Trait Implementations§
impl Freeze for EvolutionSMC
impl RefUnwindSafe for EvolutionSMC
impl Send for EvolutionSMC
impl Sync for EvolutionSMC
impl Unpin for EvolutionSMC
impl UnsafeUnpin for EvolutionSMC
impl UnwindSafe for EvolutionSMC
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.