pub trait ConjGradSolverConst: MinProblemSolverConst {
    fn as_raw_ConjGradSolver(&self) -> *const c_void;
}
Expand description

This class is used to perform the non-linear non-constrained minimization of a function with known gradient,

defined on an n-dimensional Euclidean space, using the Nonlinear Conjugate Gradient method. The implementation was done based on the beautifully clear explanatory article An Introduction to the Conjugate Gradient Method Without the Agonizing Pain by Jonathan Richard Shewchuk. The method can be seen as an adaptation of a standard Conjugate Gradient method (see, for example http://en.wikipedia.org/wiki/Conjugate_gradient_method) for numerically solving the systems of linear equations.

It should be noted, that this method, although deterministic, is rather a heuristic method and therefore may converge to a local minima, not necessary a global one. What is even more disastrous, most of its behaviour is ruled by gradient, therefore it essentially cannot distinguish between local minima and maxima. Therefore, if it starts sufficiently near to the local maximum, it may converge to it. Another obvious restriction is that it should be possible to compute the gradient of a function at any point, thus it is preferable to have analytic expression for gradient and computational burden should be born by the user.

The latter responsibility is accomplished via the getGradient method of a MinProblemSolver::Function interface (which represents function being optimized). This method takes point a point in n-dimensional space (first argument represents the array of coordinates of that point) and compute its gradient (it should be stored in the second argument as an array).

Note: class ConjGradSolver thus does not add any new methods to the basic MinProblemSolver interface.

Note: term criteria should meet following condition:

   termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0
   // or
   termcrit.type == TermCriteria::MAX_ITER) && termcrit.maxCount > 0

Required Methods

Implementors