pub struct DEConfigBuilder { /* private fields */ }Expand description
Fluent builder for DEConfig for ergonomic configuration.
§Example
use autoeq_de::{DEConfigBuilder, Strategy, Mutation};
let config = DEConfigBuilder::new()
.maxiter(500)
.popsize(20)
.strategy(Strategy::Best1Bin)
.mutation(Mutation::Factor(0.8))
.recombination(0.9)
.seed(42)
.build();Implementations§
Source§impl DEConfigBuilder
impl DEConfigBuilder
Sourcepub fn recombination(self, v: f64) -> Self
pub fn recombination(self, v: f64) -> Self
Sets the crossover probability (CR).
Sourcepub fn integrality(self, v: Vec<bool>) -> Self
pub fn integrality(self, v: Vec<bool>) -> Self
Sets the integrality mask for mixed-integer optimization.
Sourcepub fn callback(
self,
cb: Box<dyn FnMut(&DEIntermediate) -> CallbackAction>,
) -> Self
pub fn callback( self, cb: Box<dyn FnMut(&DEIntermediate) -> CallbackAction>, ) -> Self
Sets a per-iteration callback function.
Sourcepub fn add_penalty_ineq<FN>(self, f: FN, w: f64) -> Self
pub fn add_penalty_ineq<FN>(self, f: FN, w: f64) -> Self
Adds an inequality constraint penalty function.
Sourcepub fn add_penalty_eq<FN>(self, f: FN, w: f64) -> Self
pub fn add_penalty_eq<FN>(self, f: FN, w: f64) -> Self
Adds an equality constraint penalty function.
Sourcepub fn linear_penalty(self, lp: LinearPenalty) -> Self
pub fn linear_penalty(self, lp: LinearPenalty) -> Self
Sets a linear constraint penalty.
Sourcepub fn polish(self, pol: PolishConfig) -> Self
pub fn polish(self, pol: PolishConfig) -> Self
Sets the polishing configuration.
Sourcepub fn adaptive(self, adaptive: AdaptiveConfig) -> Self
pub fn adaptive(self, adaptive: AdaptiveConfig) -> Self
Sets the adaptive DE configuration.
Sourcepub fn enable_adaptive_mutation(self, enable: bool) -> Self
pub fn enable_adaptive_mutation(self, enable: bool) -> Self
Enables/disables adaptive mutation.
Sourcepub fn enable_wls(self, enable: bool) -> Self
pub fn enable_wls(self, enable: bool) -> Self
Enables/disables Wrapper Local Search.
Sourcepub fn adaptive_weights(self, w_max: f64, w_min: f64) -> Self
pub fn adaptive_weights(self, w_max: f64, w_min: f64) -> Self
Sets the adaptive weight bounds.
Sourcepub fn parallel(self, parallel: ParallelConfig) -> Self
pub fn parallel(self, parallel: ParallelConfig) -> Self
Sets the parallel evaluation configuration.
Sourcepub fn enable_parallel(self, enable: bool) -> Self
pub fn enable_parallel(self, enable: bool) -> Self
Enables/disables parallel evaluation.
Sourcepub fn parallel_threads(self, num_threads: usize) -> Self
pub fn parallel_threads(self, num_threads: usize) -> Self
Sets the number of parallel threads.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DEConfigBuilder
impl !RefUnwindSafe for DEConfigBuilder
impl !Send for DEConfigBuilder
impl !Sync for DEConfigBuilder
impl Unpin for DEConfigBuilder
impl !UnwindSafe for DEConfigBuilder
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> 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