backtracking.py

Backtracking line search using the Armijo-Goldstein condition.

class openmdao.solvers.backtracking.BackTracking[source]

Bases: openmdao.solvers.solver_base.LineSearch

A line search subsolver that implements backracking using the Armijo-Goldstein condition..

Options:

options[‘err_on_maxiter’] : bool(False)

If True, raise an AnalysisError if not converged at maxiter.

options[‘iprint’] : int(0)

Set to 0 to print only failures, set to 1 to print iteration totals to stdout, set to 2 to print the residual each iteration to stdout, or -1 to suppress all printing.

options[‘maxiter’] : int(10)

Maximum number of line searches.

options[‘solve_subsystems’] : bool(True)

Set to True to solve subsystems. You may need this for solvers nested under Newton.

options[‘rho’] : int(0.5)

Backtracking step.

options[‘c’] : int(0.5)

Slope check trigger.

solve(params, unknowns, resids, system, solver, alpha_scalar, alpha, base_u, base_norm, fnorm, fnorm0, metadata=None)[source]

Take the gradient calculated by the parent solver and figure out how far to go.

Args:

params : VecWrapper

VecWrapper containing parameters. (p)

unknowns : VecWrapper

VecWrapper containing outputs and states. (u)

resids : VecWrapper

VecWrapper containing residuals. (r)

system : System

Parent System object.

solver : Solver

Parent solver instance.

alpha_scalar : float

Initial over-relaxation factor as used in parent solver.

alpha : ndarray

Initial over-relaxation factor as used in parent solver, vector (so we don’t re-allocate).

base_u : ndarray

Initial value of unknowns before the Newton step.

base_norm : float

Norm of the residual prior to taking the Newton step.

fnorm : float

Norm of the residual after taking the Newton step.

fnorm0 : float

Initial norm of the residual for iteration printing.

metadata : dict, optional

Dictionary containing execution metadata (e.g. iteration coordinate).

Returns:

float

Norm of the final residual