simpeg.optimization.ProjectedGNCG.minimize#
- ProjectedGNCG.minimize(evalFunction, x0)[source]#
Minimizes the function (evalFunction) starting at the location x0.
- Parameters:
evalFunction (callable) – function handle that evaluates: f, g, H = F(x)
x0 (numpy.ndarray) – starting location
- Return type:
- Returns:
x, the last iterate of the optimization algorithm
evalFunction is a function handle:
(f[, g][, H]) = evalFunction(x, return_g=False, return_H=False ) def evalFunction(x, return_g=False, return_H=False): out = (f,) if return_g: out += (g,) if return_H: out += (H,) return out if len(out) > 1 else out[0]
The algorithm for general minimization is as follows:
startup(x0) printInit() while True: doStartIteration() f, g, H = evalFunction(xc) printIter() if stoppingCriteria(): break p = findSearchDirection() p = scaleSearchDirection(p) xt, passLS = modifySearchDirection(p) if not passLS: xt, caught = modifySearchDirectionBreak(p) if not caught: return xc doEndIteration(xt) print_done() finish() return xc