pub struct BrentOpt<F> { /* private fields */ }Expand description
§Brent’s method
A minimization algorithm combining parabolic interpolation and the golden-section method. It has the reliability of the golden-section method, but can be faster thanks to the parabolic interpolation steps.
§Requirements on the optimization problem
The optimization problem is required to implement CostFunction.
§Reference
“An algorithm with guaranteed convergence for finding a minimum of a function of one variable”, Algorithms for minimization without derivatives, Richard P. Brent, 1973, Prentice-Hall.
Implementations§
Source§impl<F: ArgminFloat> BrentOpt<F>
impl<F: ArgminFloat> BrentOpt<F>
Sourcepub fn new(min: F, max: F) -> Self
pub fn new(min: F, max: F) -> Self
Constructor
The values min and max must bracket the minimum of the function.
Sourcepub fn set_tolerance(self, eps: F, t: F) -> Self
pub fn set_tolerance(self, eps: F, t: F) -> Self
Set the tolerance to the value required.
The algorithm will return an approximation x of a local
minimum of the function, with an accuracy smaller than 3 tol,
where tol = eps*abs(x) + t.
It is useless to set eps to less than the square root of the
machine precision (F::epsilon().sqrt()), which is its default
value. The default value of t is 1e-5.
Trait Implementations§
Source§impl<'de, F> Deserialize<'de> for BrentOpt<F>where
F: Deserialize<'de>,
impl<'de, F> Deserialize<'de> for BrentOpt<F>where
F: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<O, F> Solver<O, IterState<F, (), (), (), (), F>> for BrentOpt<F>where
O: CostFunction<Param = F, Output = F>,
F: ArgminFloat,
impl<O, F> Solver<O, IterState<F, (), (), (), (), F>> for BrentOpt<F>where
O: CostFunction<Param = F, Output = F>,
F: ArgminFloat,
Source§fn init(
&mut self,
problem: &mut Problem<O>,
state: IterState<F, (), (), (), (), F>,
) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>
fn init( &mut self, problem: &mut Problem<O>, state: IterState<F, (), (), (), (), F>, ) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>
Source§fn next_iter(
&mut self,
problem: &mut Problem<O>,
state: IterState<F, (), (), (), (), F>,
) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>
fn next_iter( &mut self, problem: &mut Problem<O>, state: IterState<F, (), (), (), (), F>, ) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>
state and optionally a KV which holds key-value pairs used in
Observers.Source§fn terminate_internal(&mut self, state: &I) -> TerminationStatus
fn terminate_internal(&mut self, state: &I) -> TerminationStatus
Source§fn terminate(&mut self, _state: &I) -> TerminationStatus
fn terminate(&mut self, _state: &I) -> TerminationStatus
terminate_internal. Read more