pub struct Minimizer<T, U, E, A>where
A: Algorithm<T, U, E>,{
pub status: Status<T>,
/* private fields */
}Fields§
§status: Status<T>Implementations§
source§impl<T, U, E, A: Algorithm<T, U, E>> Minimizer<T, U, E, A>
impl<T, U, E, A: Algorithm<T, U, E>> Minimizer<T, U, E, A>
sourcepub fn with_algorithm(self, algorithm: A) -> Self
pub fn with_algorithm(self, algorithm: A) -> Self
sourcepub const fn with_max_steps(self, max_steps: usize) -> Self
pub const fn with_max_steps(self, max_steps: usize) -> Self
Set the maximum number of steps to perform before failure (default: 4000).
sourcepub fn with_observers(self, observers: Vec<Box<dyn Observer<T, U>>>) -> Self
pub fn with_observers(self, observers: Vec<Box<dyn Observer<T, U>>>) -> Self
sourcepub fn with_observer<O>(self, observer: O) -> Selfwhere
O: Observer<T, U> + 'static,
pub fn with_observer<O>(self, observer: O) -> Selfwhere
O: Observer<T, U> + 'static,
sourcepub fn with_bounds(self, bounds: Option<Vec<(T, T)>>) -> Self
pub fn with_bounds(self, bounds: Option<Vec<(T, T)>>) -> Self
Sets all Bounds of the Minimizer. This can be None for an unbounded problem, or
Some [Vec<(T, T)>] with length equal to the number of free parameters. Individual
upper or lower bounds can be unbounded by setting them equal to T::infinity() or
T::neg_infinity() (e.g. f64::INFINITY and f64::NEG_INFINITY).
§Panics
This function will panic if the number of bounds is not equal to the number of free parameters.
sourcepub fn with_bound(self, index: usize, bound: Option<(T, T)>) -> Self
pub fn with_bound(self, index: usize, bound: Option<(T, T)>) -> Self
Sets the Bound of the parameter at the given index.
sourcepub fn minimize(
&mut self,
func: &dyn Function<T, U, E>,
x0: &[T],
user_data: &mut U,
) -> Result<(), E>
pub fn minimize( &mut self, func: &dyn Function<T, U, E>, x0: &[T], user_data: &mut U, ) -> Result<(), E>
Minimize the given Function starting at the point x0.
This method first runs Algorithm::initialize, then runs Algorithm::step in a loop,
terminating if Algorithm::check_for_termination returns true or if
the maximum number of allowed steps is exceeded. Each step will be followed by a sequential
call to all given Observers’ callback functions, which will use the Status received
from that step’s call to Algorithm::get_status. Finally, regardless of convergence,
Algorithm::postprocessing is called. If the algorithm did not converge in the given
step limit, the Status::message will be set to "MAX EVALS" at termination.
§Errors
Returns an Err(E) if the evaluation fails. See Function::evaluate for more
information.
§Panics
This method will panic if the length of x0 is not equal to the dimension of the problem
(number of free parameters) or if any values of x0 are outside the Bounds given to the
Minimizer.
Auto Trait Implementations§
impl<T, U, E, A> Freeze for Minimizer<T, U, E, A>
impl<T, U, E, A> !RefUnwindSafe for Minimizer<T, U, E, A>
impl<T, U, E, A> !Send for Minimizer<T, U, E, A>
impl<T, U, E, A> !Sync for Minimizer<T, U, E, A>
impl<T, U, E, A> Unpin for Minimizer<T, U, E, A>
impl<T, U, E, A> !UnwindSafe for Minimizer<T, U, E, A>
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moresource§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).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.