pub struct NelderMeadBuilder { /* private fields */ }Expand description
Builder for NelderMead.
Implementations§
Source§impl NelderMeadBuilder
impl NelderMeadBuilder
Sourcepub fn ulps(&mut self, value: i64) -> &mut Self
pub fn ulps(&mut self, value: i64) -> &mut Self
The required number of floating point representations that separate two numbers to consider them equal. See crate float_cmp for more information.
Sourcepub fn maxiter<VALUE: Into<Option<usize>>>(&mut self, value: VALUE) -> &mut Self
pub fn maxiter<VALUE: Into<Option<usize>>>(&mut self, value: VALUE) -> &mut Self
The maximum number of iterations to optimize. If neither maxiter nor maxfun are given, both default to n*200 where n is the number of parameters to optimize.
Examples found in repository?
8pub fn main() {
9 let function =
10 |x: ArrayView1<f64>| (1.0 - x[0]).powi(2) + 100.0 * (x[1] - x[0].powi(2)).powi(2);
11 let minimizer = NelderMeadBuilder::default()
12 .xtol(1e-6f64)
13 .ftol(1e-6f64)
14 .maxiter(50000)
15 .build()
16 .unwrap();
17 let args = Array::from_vec(vec![3.0, -8.3]);
18 let ans = minimizer.minimize(&function, args.view());
19 println!("Final optimized arguments: {}", ans);
20}Sourcepub fn maxfun<VALUE: Into<Option<usize>>>(&mut self, value: VALUE) -> &mut Self
pub fn maxfun<VALUE: Into<Option<usize>>>(&mut self, value: VALUE) -> &mut Self
The maximum number of function calls used to optimize. If neither maxiter nor maxfun are given, both default to n*200 where n is the number of parameters to optimize.
Sourcepub fn adaptive(&mut self, value: bool) -> &mut Self
pub fn adaptive(&mut self, value: bool) -> &mut Self
Adapt algorithm parameters to dimensionality of the problem. Useful for high-dimensional minimization.
Sourcepub fn xtol(&mut self, value: f64) -> &mut Self
pub fn xtol(&mut self, value: f64) -> &mut Self
Absolute error in function parameters between iterations that is acceptable for convergence.
Examples found in repository?
8pub fn main() {
9 let function =
10 |x: ArrayView1<f64>| (1.0 - x[0]).powi(2) + 100.0 * (x[1] - x[0].powi(2)).powi(2);
11 let minimizer = NelderMeadBuilder::default()
12 .xtol(1e-6f64)
13 .ftol(1e-6f64)
14 .maxiter(50000)
15 .build()
16 .unwrap();
17 let args = Array::from_vec(vec![3.0, -8.3]);
18 let ans = minimizer.minimize(&function, args.view());
19 println!("Final optimized arguments: {}", ans);
20}Sourcepub fn ftol(&mut self, value: f64) -> &mut Self
pub fn ftol(&mut self, value: f64) -> &mut Self
Absolute error in function values between iterations that is acceptable for convergence.
Examples found in repository?
8pub fn main() {
9 let function =
10 |x: ArrayView1<f64>| (1.0 - x[0]).powi(2) + 100.0 * (x[1] - x[0].powi(2)).powi(2);
11 let minimizer = NelderMeadBuilder::default()
12 .xtol(1e-6f64)
13 .ftol(1e-6f64)
14 .maxiter(50000)
15 .build()
16 .unwrap();
17 let args = Array::from_vec(vec![3.0, -8.3]);
18 let ans = minimizer.minimize(&function, args.view());
19 println!("Final optimized arguments: {}", ans);
20}Sourcepub fn build(&self) -> Result<NelderMead, String>
pub fn build(&self) -> Result<NelderMead, String>
Examples found in repository?
8pub fn main() {
9 let function =
10 |x: ArrayView1<f64>| (1.0 - x[0]).powi(2) + 100.0 * (x[1] - x[0].powi(2)).powi(2);
11 let minimizer = NelderMeadBuilder::default()
12 .xtol(1e-6f64)
13 .ftol(1e-6f64)
14 .maxiter(50000)
15 .build()
16 .unwrap();
17 let args = Array::from_vec(vec![3.0, -8.3]);
18 let ans = minimizer.minimize(&function, args.view());
19 println!("Final optimized arguments: {}", ans);
20}Trait Implementations§
Source§impl Clone for NelderMeadBuilder
impl Clone for NelderMeadBuilder
Source§fn clone(&self) -> NelderMeadBuilder
fn clone(&self) -> NelderMeadBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for NelderMeadBuilder
impl Default for NelderMeadBuilder
Source§fn default() -> NelderMeadBuilder
fn default() -> NelderMeadBuilder
Auto Trait Implementations§
impl Freeze for NelderMeadBuilder
impl RefUnwindSafe for NelderMeadBuilder
impl Send for NelderMeadBuilder
impl Sync for NelderMeadBuilder
impl Unpin for NelderMeadBuilder
impl UnwindSafe for NelderMeadBuilder
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> 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