pub struct ExternalArchive { /* private fields */ }Expand description
External archive storing discarded solutions
Implementations§
Source§impl ExternalArchive
impl ExternalArchive
Sourcepub fn with_population_size(np: usize, arc_rate: f64) -> Self
pub fn with_population_size(np: usize, arc_rate: f64) -> Self
Create archive with size proportional to population
Sourcepub fn add(&mut self, solution: Array1<f64>)
pub fn add(&mut self, solution: Array1<f64>)
Add a solution to the archive If archive is full, removes a random solution
Sourcepub fn random_select<R: Rng + ?Sized>(
&self,
rng: &mut R,
) -> Option<&Array1<f64>>
pub fn random_select<R: Rng + ?Sized>( &self, rng: &mut R, ) -> Option<&Array1<f64>>
Select a random solution from the archive Returns None if archive is empty
Sourcepub fn random_index<R: Rng + ?Sized>(&self, rng: &mut R) -> Option<usize>
pub fn random_index<R: Rng + ?Sized>(&self, rng: &mut R) -> Option<usize>
Get a random index for archive selection Returns None if archive is empty, otherwise returns a valid index into the archive
Trait Implementations§
Source§impl Clone for ExternalArchive
impl Clone for ExternalArchive
Source§fn clone(&self) -> ExternalArchive
fn clone(&self) -> ExternalArchive
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExternalArchive
impl RefUnwindSafe for ExternalArchive
impl Send for ExternalArchive
impl Sync for ExternalArchive
impl Unpin for ExternalArchive
impl UnsafeUnpin for ExternalArchive
impl UnwindSafe for ExternalArchive
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