LineSearch

Trait LineSearch 

Source
pub trait LineSearch {
    // Required method
    fn search<F, G>(
        &self,
        f: &F,
        grad: &G,
        x: &Vector<f32>,
        d: &Vector<f32>,
    ) -> f32
       where F: Fn(&Vector<f32>) -> f32,
             G: Fn(&Vector<f32>) -> Vector<f32>;
}
Expand description

Line search strategy for determining step size in batch optimization.

Line search methods find an appropriate step size α along a search direction d by solving the 1D optimization problem:

minimize f(x + α*d) over α > 0

Different strategies enforce different conditions on the step size.

Required Methods§

Source

fn search<F, G>(&self, f: &F, grad: &G, x: &Vector<f32>, d: &Vector<f32>) -> f32
where F: Fn(&Vector<f32>) -> f32, G: Fn(&Vector<f32>) -> Vector<f32>,

Finds a suitable step size along the search direction.

§Arguments
  • f - Objective function f: ℝⁿ → ℝ
  • grad - Gradient function ∇f: ℝⁿ → ℝⁿ
  • x - Current point
  • d - Search direction (typically descent direction, ∇f(x)·d < 0)
§Returns

Step size α > 0 satisfying the line search conditions

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.

Implementors§