pymor.algorithms.bfgs
¶
Module Contents¶
- pymor.algorithms.bfgs.error_aware_bfgs(model, parameter_space=None, initial_guess=None, miniter=0, maxiter=100, rtol_output=1e-16, rtol_mu=1e-16, tol_sub=1e-08, line_search_params=None, stagnation_window=3, stagnation_threshold=np.inf, error_aware=False, error_criterion=None, line_search_error_criterion=None)[source]¶
BFGS algorithm.
This method solves the optimization problem
min J(mu), mu in C
for a model with an output functional \(J\) depending on a box-constrained
mu
using the BFGS method.In contrast to
scipy.optimize.minimize
with theL-BFGS-B
methods, this BFGS implementation is explicitly designed to work with an error estimator. In particular, this implementation terminates if the higher level TR boundary frompymor.algorithms.tr
is reached instead of continuing to optimize close to the boundary.Parameters
- model
The
Model
with outputJ
used for the optimization.- parameter_space
If not
None
, theParameterSpace
for enforcing the box constraints on theparameter values
mu
. Otherwise aParameterSpace
with lower bound -1 and upper bound 1.- initial_guess
If not
None
,parameter values
containing an initial guess for the solutionmu
. Otherwise, randomparameter values
from the parameter space are chosen as the initial value.- miniter
Minimum amount of iterations to perform.
- maxiter
Fail if the iteration count reaches this value without converging.
- rtol_output
Finish when the relative error measure of the output is below this threshold.
- rtol_mu
Finish when the relative error measure of the
parameter values
is below this threshold.- tol_sub
Finish when the first order criticality is below this threshold.
- line_search_params
Dictionary of additional parameters passed to the Armijo line search method.
- stagnation_window
Finish when the parameter update has not been enlarged by a factor of
stagnation_threshold
during the laststagnation_window
iterations.- stagnation_threshold
See
stagnation_window
.- error_aware
If
True
, perform an additional error aware check during the line search phase. Intended for use with the trust region algorithm.- error_criterion
The additional error criterion used to check model confidence. This maps
parameter values
and an output value to a boolean indicating if the criterion is fulfilled. Refer to functionerror_aware_bfgs_criterion
inpymor.algorithms.tr.trust_region
for an example.- line_search_error_criterion
The additional error criterion used to check model confidence in the line search. This maps
parameter values
and an output value to a boolean indicating if the criterion is fulfilled. Refer to functionerror_aware_line_search_criterion
inpymor.algorithms.tr.trust_region
for an example.
Returns
- mu
NumPy array
containing the computedparameter values
.- data
Dict containing the following fields:
- mus:
list
ofparameter values
after each iteration.- foc_norms:
NumPy array
of the first order criticality norms after each iteration.- update_norms:
NumPy array
of the norms of the update vectors after each iteration.- iterations:
Number of total BFGS iterations.
- line_search_iterations:
NumPy array
of the number of line search iterations per BFGS iteration.
Raises
- BFGSError
Raised if the BFGS algorithm failed to converge.