pub fn minimize_tnc(
fg: impl FnMut(&[f64]) -> (f64, Vec<f64>),
x0: &[f64],
lb: &[f64],
ub: &[f64],
options: TncOptions,
) -> Result<BoundedResult, ErrorsJSL>Expand description
Minimises f subject to lb ≤ x ≤ ub by a truncated Newton method; fg returns f and its
gradient. Each iteration fixes the variables on a bound whose gradient points outwards, and
solves the Newton equations H p = −g for the others only approximately, by conjugate
gradients stopped at a relative residual min(½, √‖g‖) or at negative curvature; the
Hessian-vector products are forward differences of the gradient, so no Hessian is needed.
A projected backtracking line search along p keeps the iterates in the box.