Module gosh_lbfgs::line_new
source · [−]Expand description
Find a satisfactory step length along predefined search direction
Example
use liblbfgs::math::LbfgsMath;
use liblbfgs::Problem;
use liblbfgs::default_evaluate;
use liblbfgs::line::LineSearch;
const N: usize = 100;
let mut x = [0.0; N];
for i in (0..N).step_by(2) {
x[i] = -1.2;
x[i + 1] = 1.0;
}
// construct problem
let mut prb = Problem::new(&mut x, default_evaluate(), None);
prb.evaluate();
// construct initial search direction
prb.update_search_direction();
// Compute the initial step
let mut step = 1.0/prb.search_direction().vec2norm();
let ls = LineSearch::default();
let ncall = ls.find(&mut prb, &mut step).expect("line search");
Structs
Enums
Line search algorithms.