pub struct EvolutionOptions { /* private fields */ }Implementations§
Source§impl EvolutionOptions
impl EvolutionOptions
Sourcepub fn new(
num_generations: usize,
log_level: LogLevel,
population_size: usize,
num_offsprings: usize,
) -> Self
pub fn new( num_generations: usize, log_level: LogLevel, population_size: usize, num_offsprings: usize, ) -> Self
Creates a new EvolutionOptions instance with the specified parameters.
§Arguments
num_generations- The number of generations to evolve.log_level- The logging level for the algorithm.population_size- The size of the population in each generation.num_offsprings- The number of offspring to generate in each generation.
§Returns
A new EvolutionOptions instance.
§Example
use genalg::evolution::options::{EvolutionOptions, LogLevel};
let options = EvolutionOptions::new(100, LogLevel::Info, 10, 50);Sourcepub fn new_with_threshold(
num_generations: usize,
log_level: LogLevel,
population_size: usize,
num_offsprings: usize,
parallel_threshold: usize,
) -> Self
pub fn new_with_threshold( num_generations: usize, log_level: LogLevel, population_size: usize, num_offsprings: usize, parallel_threshold: usize, ) -> Self
Creates a new EvolutionOptions instance with the specified parameters,
including a custom parallel threshold.
§Arguments
num_generations- The number of generations to evolve.log_level- The logging level for the algorithm.population_size- The size of the population in each generation.num_offsprings- The number of offspring to generate in each generation.parallel_threshold- The minimum number of items to process in parallel.
§Returns
A new EvolutionOptions instance.
§Example
use genalg::evolution::options::{EvolutionOptions, LogLevel};
let options = EvolutionOptions::new_with_threshold(100, LogLevel::Info, 10, 50, 1000);pub fn get_num_generations(&self) -> usize
pub fn get_log_level(&self) -> &LogLevel
pub fn get_population_size(&self) -> usize
pub fn get_num_offspring(&self) -> usize
Sourcepub fn get_parallel_threshold(&self) -> usize
pub fn get_parallel_threshold(&self) -> usize
Returns the minimum number of items to process in parallel.
Sourcepub fn get_use_caching(&self) -> bool
pub fn get_use_caching(&self) -> bool
Returns whether caching is enabled.
Sourcepub fn get_cache_type(&self) -> CacheType
pub fn get_cache_type(&self) -> CacheType
Returns the type of cache to use.
Sourcepub fn set_num_generations(&mut self, num_generations: usize)
pub fn set_num_generations(&mut self, num_generations: usize)
Sets the number of generations.
Sourcepub fn set_log_level(&mut self, log_level: LogLevel)
pub fn set_log_level(&mut self, log_level: LogLevel)
Sets the log level.
Sourcepub fn set_population_size(&mut self, population_size: usize)
pub fn set_population_size(&mut self, population_size: usize)
Sets the population size.
Sourcepub fn set_num_offspring(&mut self, num_offsprings: usize)
pub fn set_num_offspring(&mut self, num_offsprings: usize)
Sets the number of offspring.
Sourcepub fn set_parallel_threshold(&mut self, threshold: usize)
pub fn set_parallel_threshold(&mut self, threshold: usize)
Sets the parallel threshold.
Sourcepub fn set_use_caching(&mut self, use_caching: bool)
pub fn set_use_caching(&mut self, use_caching: bool)
Sets whether to use caching.
Sourcepub fn set_cache_type(&mut self, cache_type: CacheType)
pub fn set_cache_type(&mut self, cache_type: CacheType)
Sets the type of cache to use.
Sourcepub fn builder() -> EvolutionOptionsBuilder
pub fn builder() -> EvolutionOptionsBuilder
Creates a builder for constructing an EvolutionOptions instance.
This method returns an EvolutionOptionsBuilder that can be used to
construct an EvolutionOptions instance using the builder pattern.
§Returns
An EvolutionOptionsBuilder instance.
§Example
use genalg::evolution::options::{EvolutionOptions, LogLevel};
let options = EvolutionOptions::builder()
.num_generations(200)
.log_level(LogLevel::Info)
.population_size(50)
.num_offspring(100)
.parallel_threshold(500)
.build();Trait Implementations§
Source§impl Clone for EvolutionOptions
impl Clone for EvolutionOptions
Source§fn clone(&self) -> EvolutionOptions
fn clone(&self) -> EvolutionOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EvolutionOptions
impl Debug for EvolutionOptions
Auto Trait Implementations§
impl Freeze for EvolutionOptions
impl RefUnwindSafe for EvolutionOptions
impl Send for EvolutionOptions
impl Sync for EvolutionOptions
impl Unpin for EvolutionOptions
impl UnwindSafe for EvolutionOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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