pub struct HagerZhangLineSearch<P, G, F> { /* private fields */ }
Expand description

The Hager-Zhang line search is a method to find a step length which obeys the strong Wolfe conditions.

Requirements on the optimization problem

The optimization problem is required to implement CostFunction and Gradient.

Reference

William W. Hager and Hongchao Zhang. “A new conjugate gradient method with guaranteed descent and an efficient line search.” SIAM J. Optim. 16(1), 2006, 170-192. DOI: https://doi.org/10.1137/030601880

Implementations

Construct a new instance of HagerZhangLineSearch

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> = HagerZhangLineSearch::new();

Set delta and sigma.

Delta defaults to 0.1 and must be in (0, 1). Sigma defaults to 0.9 and must be in [delta, 1).

Delta and Sigma correspond to the constants c1 and c2 of the strong Wolfe conditions, respectively.

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> =
    HagerZhangLineSearch::new().with_delta_sigma(0.2, 0.8)?;

Set epsilon

Used in the approximate strong Wolfe condition.

Must be non-negative and defaults to 1e-6.

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> =
    HagerZhangLineSearch::new().with_epsilon(1e-8)?;

Set theta

Used in the update rules when the potential intervals [a, c] or [c, b] violate the opposite slope condition.

Must be in (0, 1) and defaults to 0.5.

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> =
    HagerZhangLineSearch::new().with_theta(0.4)?;

Set gamma

Determines when a bisection step is performed.

Must be in (0, 1) and defaults to 0.66.

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> =
    HagerZhangLineSearch::new().with_gamma(0.7)?;

Set eta

Used in the lower bound for beta_k^N.

Must be larger than zero and defaults to 0.01.

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> =
    HagerZhangLineSearch::new().with_eta(0.02)?;

Set lower and upper bound of step

Defaults to a minimum step length of EPSILON and a maximum step length of 1e5.

The chosen values must satisfy 0 <= step_min < step_max.

Example
let hzls: HagerZhangLineSearch<Vec<f64>, Vec<f64>, f64> =
    HagerZhangLineSearch::new().with_bounds(1e-3, 1.0)?;

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Set search direction

Set initial alpha value

Serialize this value into the given Serde serializer. Read more

Name of the solver. Mainly used in Observers.

Initializes the algorithm. Read more

Computes a single iteration of the algorithm and has access to the optimization problem definition and the internal state of the solver. Returns an updated state and optionally a KV which holds key-value pairs used in Observers. Read more

Used to implement stopping criteria, in particular criteria which are not covered by (terminate_internal. Read more

Checks whether basic termination reasons apply. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.