backtracking.py

backtracking.py

A few different backtracking line search subsolvers.

BoundsEnforceLS - Only checks bounds and enforces them by one of three methods. ArmijoGoldsteinLS – Like above, but terminates with the ArmijoGoldsteinLS condition.

class openmdao.solvers.linesearch.backtracking.ArmijoGoldsteinLS(**kwargs)[source]

Bases: openmdao.solvers.linesearch.backtracking.LinesearchSolver

Backtracking line search that terminates using the Armijo-Goldstein condition.

Parameters
**kwargsdict

Options dictionary.

Attributes
_analysis_error_raisedbool

Flag is set to True if a subsystem raises an AnalysisError.

SOLVER = 'LS: AG'
__init__(**kwargs)[source]

Initialize all attributes.

add_recorder(recorder)

Add a recorder to the solver’s RecordingManager.

Parameters
recorder<CaseRecorder>

A recorder instance to be added to RecManager.

cleanup()

Clean up resources prior to exit.

get_reports_dir()

Get the path to the directory where the report files should go.

If it doesn’t exist, it will be created.

Returns
str

The path to the directory where reports should be written.

property msginfo

Return info to prepend to messages.

Returns
str

Info to prepend to messages.

record_iteration(**kwargs)

Record an iteration of the current Solver.

Parameters
**kwargsdict

Keyword arguments (used for abs and rel error).

solve()

Run the solver.

class openmdao.solvers.linesearch.backtracking.BoundsEnforceLS(**kwargs)[source]

Bases: openmdao.solvers.linesearch.backtracking.LinesearchSolver

Bounds enforcement only.

Not so much a linesearch; just check the bounds and if they are violated, then pull back to a non-violating point and evaluate.

Parameters
**kwargsdict

Options dictionary.

SOLVER = 'LS: BCHK'
__init__(**kwargs)

Initialize all attributes.

Parameters
**kwargsdict

Options dictionary.

add_recorder(recorder)

Add a recorder to the solver’s RecordingManager.

Parameters
recorder<CaseRecorder>

A recorder instance to be added to RecManager.

cleanup()

Clean up resources prior to exit.

get_reports_dir()

Get the path to the directory where the report files should go.

If it doesn’t exist, it will be created.

Returns
str

The path to the directory where reports should be written.

property msginfo

Return info to prepend to messages.

Returns
str

Info to prepend to messages.

record_iteration(**kwargs)

Record an iteration of the current Solver.

Parameters
**kwargsdict

Keyword arguments (used for abs and rel error).

solve()

Run the solver.

class openmdao.solvers.linesearch.backtracking.LinesearchSolver(**kwargs)[source]

Bases: openmdao.solvers.solver.NonlinearSolver

Base class for line search solvers.

Parameters
**kwargsdict

Options dictionary.

Attributes
_do_subsolvebool

Flag used by parent solver to tell the line search whether to solve subsystems while backtracking.

_lower_boundsndarray or None

Lower bounds array.

_upper_boundsndarray or None

Upper bounds array.

SOLVER = 'base_solver'
__init__(**kwargs)[source]

Initialize all attributes.

Parameters
**kwargsdict

Options dictionary.

add_recorder(recorder)

Add a recorder to the solver’s RecordingManager.

Parameters
recorder<CaseRecorder>

A recorder instance to be added to RecManager.

cleanup()

Clean up resources prior to exit.

get_reports_dir()

Get the path to the directory where the report files should go.

If it doesn’t exist, it will be created.

Returns
str

The path to the directory where reports should be written.

property msginfo

Return info to prepend to messages.

Returns
str

Info to prepend to messages.

record_iteration(**kwargs)

Record an iteration of the current Solver.

Parameters
**kwargsdict

Keyword arguments (used for abs and rel error).

solve()

Run the solver.