Struct argmin::solver::goldensectionsearch::GoldenSectionSearch
source · pub struct GoldenSectionSearch<F> { /* private fields */ }
Expand description
§Golden-section search
The golden-section search is a technique for finding an extremum (minimum or maximum) of a function inside a specified interval.
The method operates by successively narrowing the range of values on the specified interval, which makes it relatively slow, but very robust. The technique derives its name from the fact that the algorithm maintains the function values for four points whose three interval widths are in the ratio 2-φ:2φ-3:2-φ where φ is the golden ratio. These ratios are maintained for each iteration and are maximally efficient.
The min_bound
and max_bound
arguments define values that bracket the expected minimum.
Requires an initial guess which is to be provided via Executor
s
configure
method.
§Requirements on the optimization problem
The optimization problem is required to implement CostFunction
.
§Reference
Implementations§
source§impl<F> GoldenSectionSearch<F>where
F: ArgminFloat,
impl<F> GoldenSectionSearch<F>where
F: ArgminFloat,
sourcepub fn new(min_bound: F, max_bound: F) -> Result<Self, Error>
pub fn new(min_bound: F, max_bound: F) -> Result<Self, Error>
Construct a new instance of GoldenSectionSearch
.
The min_bound
and max_bound
arguments define values that bracket the expected minimum.
§Example
let gss = GoldenSectionSearch::new(-2.5f64, 3.0f64)?;
sourcepub fn with_tolerance(self, tolerance: F) -> Result<Self, Error>
pub fn with_tolerance(self, tolerance: F) -> Result<Self, Error>
Set tolerance.
Must be larger than 0
and defaults to 0.01
.
§Example
let gss = GoldenSectionSearch::new(-2.5f64, 3.0f64)?.with_tolerance(0.0001)?;
Trait Implementations§
source§impl<F: Clone> Clone for GoldenSectionSearch<F>
impl<F: Clone> Clone for GoldenSectionSearch<F>
source§fn clone(&self) -> GoldenSectionSearch<F>
fn clone(&self) -> GoldenSectionSearch<F>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'de, F> Deserialize<'de> for GoldenSectionSearch<F>where
F: Deserialize<'de>,
impl<'de, F> Deserialize<'de> for GoldenSectionSearch<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<F> Serialize for GoldenSectionSearch<F>where
F: Serialize,
impl<F> Serialize for GoldenSectionSearch<F>where
F: Serialize,
source§impl<O, F> Solver<O, IterState<F, (), (), (), (), F>> for GoldenSectionSearch<F>where
O: CostFunction<Param = F, Output = F>,
F: ArgminFloat,
impl<O, F> Solver<O, IterState<F, (), (), (), (), F>> for GoldenSectionSearch<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(
&mut self,
_state: &IterState<F, (), (), (), (), F>,
) -> TerminationStatus
fn terminate( &mut self, _state: &IterState<F, (), (), (), (), F>, ) -> TerminationStatus
terminate_internal
. Read moresource§fn terminate_internal(&mut self, state: &I) -> TerminationStatus
fn terminate_internal(&mut self, state: &I) -> TerminationStatus
Auto Trait Implementations§
impl<F> Freeze for GoldenSectionSearch<F>where
F: Freeze,
impl<F> RefUnwindSafe for GoldenSectionSearch<F>where
F: RefUnwindSafe,
impl<F> Send for GoldenSectionSearch<F>where
F: Send,
impl<F> Sync for GoldenSectionSearch<F>where
F: Sync,
impl<F> Unpin for GoldenSectionSearch<F>where
F: Unpin,
impl<F> UnwindSafe for GoldenSectionSearch<F>where
F: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.