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
muusing the BFGS method.In contrast to
scipy.optimize.minimizewith theL-BFGS-Bmethods, 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.tris reached instead of continuing to optimize close to the boundary.Parameters
- model
The
Modelwith outputJused for the optimization.- parameter_space
If not
None, theParameterSpacefor enforcing the box constraints on theparameter valuesmu. Otherwise aParameterSpacewith lower bound -1 and upper bound 1.- initial_guess
If not
None,parameter valuescontaining an initial guess for the solutionmu. Otherwise, randomparameter valuesfrom 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 valuesis 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_thresholdduring the laststagnation_windowiterations.- 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 valuesand an output value to a boolean indicating if the criterion is fulfilled. Refer to functionerror_aware_bfgs_criterioninpymor.algorithms.tr.trust_regionfor an example.- line_search_error_criterion
The additional error criterion used to check model confidence in the line search. This maps
parameter valuesand an output value to a boolean indicating if the criterion is fulfilled. Refer to functionerror_aware_line_search_criterioninpymor.algorithms.tr.trust_regionfor an example.
Returns
- mu
NumPy arraycontaining the computedparameter values.- data
Dict containing the following fields:
- mus:
listofparameter valuesafter each iteration.- foc_norms:
NumPy arrayof the first order criticality norms after each iteration.- update_norms:
NumPy arrayof the norms of the update vectors after each iteration.- iterations:
Number of total BFGS iterations.
- line_search_iterations:
NumPy arrayof the number of line search iterations per BFGS iteration.
Raises
- BFGSError
Raised if the BFGS algorithm failed to converge.