pub trait MinProblemSolverTrait: AlgorithmTrait + MinProblemSolverTraitConst {
// Required method
fn as_raw_mut_MinProblemSolver(&mut self) -> *mut c_void;
// Provided methods
fn set_function(&mut self, f: &Ptr<MinProblemSolver_Function>) -> Result<()> { ... }
fn set_term_criteria(&mut self, termcrit: TermCriteria) -> Result<()> { ... }
fn minimize(&mut self, x: &mut impl ToInputOutputArray) -> Result<f64> { ... }
}
Expand description
Mutable methods for core::MinProblemSolver
Required Methods§
fn as_raw_mut_MinProblemSolver(&mut self) -> *mut c_void
Provided Methods§
Sourcefn set_function(&mut self, f: &Ptr<MinProblemSolver_Function>) -> Result<()>
fn set_function(&mut self, f: &Ptr<MinProblemSolver_Function>) -> Result<()>
Setter for the optimized function.
It should be called at least once before the call to minimize(), as default value is not usable.
§Parameters
- f: The new function to optimize.
Sourcefn set_term_criteria(&mut self, termcrit: TermCriteria) -> Result<()>
fn set_term_criteria(&mut self, termcrit: TermCriteria) -> Result<()>
Set terminal criteria for solver.
This method is not necessary to be called before the first call to minimize(), as the default value is sensible.
Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when the function values at the vertices of simplex are within termcrit.epsilon range or simplex becomes so small that it can enclosed in a box with termcrit.epsilon sides, whatever comes first.
§Parameters
- termcrit: Terminal criteria to be used, represented as cv::TermCriteria structure.
Sourcefn minimize(&mut self, x: &mut impl ToInputOutputArray) -> Result<f64>
fn minimize(&mut self, x: &mut impl ToInputOutputArray) -> Result<f64>
actually runs the algorithm and performs the minimization.
The sole input parameter determines the centroid of the starting simplex (roughly, it tells where to start), all the others (terminal criteria, initial step, function to be minimized) are supposed to be set via the setters before the call to this method or the default values (not always sensible) will be used.
§Parameters
- x: The initial point, that will become a centroid of an initial simplex. After the algorithm will terminate, it will be set to the point where the algorithm stops, the point of possible minimum.
§Returns
The value of a function at the point found.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.