pub struct CmaEs<F> {
pub state: CmaEsState,
pub bounds: Option<MultiBounds>,
/* private fields */
}Expand description
CMA-ES optimizer
Fields§
§state: CmaEsStateState of the optimizer
bounds: Option<MultiBounds>Problem bounds
Implementations§
Source§impl<F: CmaEsFitness> CmaEs<F>
impl<F: CmaEsFitness> CmaEs<F>
Sourcepub fn with_lambda(
initial_mean: Vec<f64>,
initial_sigma: f64,
lambda: usize,
) -> Self
pub fn with_lambda( initial_mean: Vec<f64>, initial_sigma: f64, lambda: usize, ) -> Self
Create with custom population size
Sourcepub fn with_bounds(self, bounds: MultiBounds) -> Self
pub fn with_bounds(self, bounds: MultiBounds) -> Self
Set problem bounds
Sourcepub fn step<R: Rng>(
&mut self,
fitness: &F,
rng: &mut R,
) -> EvoResult<Vec<Individual<RealVector>>>
pub fn step<R: Rng>( &mut self, fitness: &F, rng: &mut R, ) -> EvoResult<Vec<Individual<RealVector>>>
Run a single generation
Sourcepub fn run_generations<R: Rng>(
&mut self,
fitness: &F,
max_generations: usize,
rng: &mut R,
) -> EvoResult<Individual<RealVector>>
pub fn run_generations<R: Rng>( &mut self, fitness: &F, max_generations: usize, rng: &mut R, ) -> EvoResult<Individual<RealVector>>
Run the optimizer for a fixed number of generations
Sourcepub fn run_until<R: Rng>(
&mut self,
fitness: &F,
target_fitness: f64,
max_generations: usize,
rng: &mut R,
) -> EvoResult<Individual<RealVector>>
pub fn run_until<R: Rng>( &mut self, fitness: &F, target_fitness: f64, max_generations: usize, rng: &mut R, ) -> EvoResult<Individual<RealVector>>
Run the optimizer until a target fitness is reached or max generations
Sourcepub fn generation(&self) -> usize
pub fn generation(&self) -> usize
Get the current generation
Sourcepub fn evaluations(&self) -> usize
pub fn evaluations(&self) -> usize
Get total evaluations
Sourcepub fn best_solution(&self) -> &[f64]
pub fn best_solution(&self) -> &[f64]
Get the best solution found
Sourcepub fn best_fitness(&self) -> f64
pub fn best_fitness(&self) -> f64
Get the best fitness found
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for CmaEs<F>
impl<F> RefUnwindSafe for CmaEs<F>where
F: RefUnwindSafe,
impl<F> Send for CmaEs<F>where
F: Send,
impl<F> Sync for CmaEs<F>where
F: Sync,
impl<F> Unpin for CmaEs<F>where
F: Unpin,
impl<F> UnsafeUnpin for CmaEs<F>
impl<F> UnwindSafe for CmaEs<F>where
F: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.