pub struct Success<G> { /* private fields */ }
Expand description
Define the successful outcome of a genetic algorithm search.
Implementations§
Source§impl<G> Success<G>
impl<G> Success<G>
pub fn new( reason: Reason, epoch: usize, elapsed: Duration, best_cost: f64, mean_cost: f64, worst_cost: f64, best_genome: G, ) -> Self
Sourcepub fn epoch(&self) -> usize
pub fn epoch(&self) -> usize
The number of epochs (iterations) the search took before terminating.
Sourcepub fn best_cost(&self) -> f64
pub fn best_cost(&self) -> f64
The cost of the best genome found by the search algorithm.
This is the cost associated with Success::best_genome
.
Sourcepub fn worst_cost(&self) -> f64
pub fn worst_cost(&self) -> f64
The worst cost found in the final generation of the algorithm.
Sourcepub fn best_genome(&self) -> &G
pub fn best_genome(&self) -> &G
The best (lowest cost) genome found by the search algorithm.
This is the genome associated with Success::best_cost
.
Trait Implementations§
impl<G> StructuralPartialEq for Success<G>
Auto Trait Implementations§
impl<G> Freeze for Success<G>where
G: Freeze,
impl<G> RefUnwindSafe for Success<G>where
G: RefUnwindSafe,
impl<G> Send for Success<G>where
G: Send,
impl<G> Sync for Success<G>where
G: Sync,
impl<G> Unpin for Success<G>where
G: Unpin,
impl<G> UnwindSafe for Success<G>where
G: 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