seisflows.optimize.NLCG

Nonlinear conjugate gradient method for optimization

Module Contents

Classes

NLCG

NLCG Optimization

Functions

check_conjugacy(g_new, g_old)

Check for conjugacy between two vectors

check_descent(p_new, g_new)

Ensure that the search direction is descending

class seisflows.optimize.NLCG.NLCG(nlcg_max=np.inf, nlcg_thresh=np.inf, calc_beta='pollak_ribere', **kwargs)

Bases: seisflows.optimize.gradient.Gradient

NLCG Optimization

Nonlinear conjugate gradient method

Parameters

type nlcg_max

int

param nlcg_max

NLCG periodic restart interval, should be between 1 and infinity

type nlcg_thresh

NLCG conjugacy restart threshold, should be between 1 and infinity

type calc_beta

str

param calc_beta

method to calculate the parameter ‘beta’ in the NLCG algorithm. Available: ‘pollak_ribere’, ‘fletcher_reeves’

Paths

***

__doc__
checkpoint()

Overwrite default checkpointing to store internal L-BFGS Attributes

compute_direction()

Compute search direction using the Nonlinear Conjugate Gradient method The potential outcomes when computing direction with NLCG

  1. First iteration of an NLCG optimization, search direction is

    the inverse gradient

  2. NLCG internal iteration ticks over the maximum allowable number of

    iterations, force a restart condition, search direction is the inverse gradient

  3. New NLCG search direction does not have conjugacy with previous

    search direction, force restart, inverse gradient search direction

  4. New NLCG search direction is not a descent direction,

    force restart, inverse gradient search direction

  5. New NLCG search direction has conjugacy and is a descent direction

    and is set as the new search direction.

Return type

seisflows.tools.specfem.Model

Returns

search direction as a Model instance

restart()

Overwrite the Base restart class and include a restart of the NLCG

_fletcher_reeves(g_new, g_old)

One method for calculating beta in the NLCG Algorithm from Fletcher & Reeves, 1964

Parameters
  • g_new (np.array) – new search direction

  • g_old (np.array) – old search direction

Return type

float

Returns

beta, the scale factor to apply to the old search direction to determine the new search direction

_pollak_ribere(g_new, g_old)

One method for calculating beta in the NLCG Algorithm from Polak & Ribiere, 1969

Parameters
  • g_new (np.array) – new search direction

  • g_old (np.array) – old search direction

Return type

float

Returns

beta, the scale factor to apply to the old search direction to determine the new search direction

seisflows.optimize.NLCG.check_conjugacy(g_new, g_old)

Check for conjugacy between two vectors

Parameters
  • g_new (np.array) – new search direction

  • g_old (np.array) – old search direction

Return type

float

Returns

an element that proves conjugacy

seisflows.optimize.NLCG.check_descent(p_new, g_new)

Ensure that the search direction is descending

Parameters
  • p_new (np.array) – search direction

  • g_new (np.array) – gradient direction

Return type

float

Returns

the angle between search direction and gradient direction, should be negative to ensure descent