pub struct BayesianAdaptiveGA<P, F>{ /* private fields */ }Expand description
A single-level Bayesian adaptive genetic algorithm.
See the module docs for the model. Operator step sizes are selected
by Thompson sampling over per-operator Beta success posteriors, which are
updated by conjugate Bayesian updates from observed improvement events.
§What the prior is used for
This is a genetic algorithm, not a posterior sampler: the
GenomePrior draws the initial population and defines the
feasible region — a child whose encoding falls outside the prior’s
support (a UniformBoxPrior’s box, a
grammar’s depth limit) is discarded before evaluation and its parent
keeps the slot, counted as a failed trial. The prior’s density does not
otherwise enter selection; the Bayesian content is the conjugate
operator-selection model. For the Boltzmann posterior itself use
EvolutionChain or
EvolutionSMC.
Implementations§
Source§impl<P, F> BayesianAdaptiveGA<P, F>
impl<P, F> BayesianAdaptiveGA<P, F>
Sourcepub fn new(
prior: P,
fitness: F,
population_size: usize,
generations: usize,
) -> Self
pub fn new( prior: P, fitness: F, population_size: usize, generations: usize, ) -> Self
Create a new adaptive GA with a default set of mutation step sizes.
Sourcepub fn with_step_sizes(self, sigmas: Vec<f64>) -> Self
pub fn with_step_sizes(self, sigmas: Vec<f64>) -> Self
Replace the operator step sizes (each gets a fresh Beta(1, 1) prior).
Sourcepub fn with_mutation_rate(self, rate: f64) -> Self
pub fn with_mutation_rate(self, rate: f64) -> Self
Set the coordinate mutation probability.
Sourcepub fn with_tournament_size(self, size: usize) -> Self
pub fn with_tournament_size(self, size: usize) -> Self
Set the tournament size for parent selection.
Auto Trait Implementations§
impl<P, F> Freeze for BayesianAdaptiveGA<P, F>
impl<P, F> RefUnwindSafe for BayesianAdaptiveGA<P, F>
impl<P, F> Send for BayesianAdaptiveGA<P, F>
impl<P, F> Sync for BayesianAdaptiveGA<P, F>
impl<P, F> Unpin for BayesianAdaptiveGA<P, F>
impl<P, F> UnsafeUnpin for BayesianAdaptiveGA<P, F>
impl<P, F> UnwindSafe for BayesianAdaptiveGA<P, F>
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.