pymor.algorithms.tr¶
Module Contents¶
- class pymor.algorithms.tr.BasicTRSurrogate(reductor, initial_guess, name=None)[source]¶
Bases:
TRSurrogateSurrogate for
trust_regiononly enriching with the primal solution.Parameters
- reductor
The reductor used to generate the reduced order models and estimate the output error.
- initial_guess
The
parameter valuescontaining an initial guess for the optimal parameter value.
Methods
Extend the current ROM for new
parameter values.- extend(mu)[source]¶
Extend the current ROM for new
parameter values.Parameters
- mu
The
Muinstance for which an extension is computed.
- class pymor.algorithms.tr.PrimalDualTRSurrogate(reductor, initial_guess, name=None)[source]¶
Bases:
TRSurrogateSurrogate for
trust_regionenriching with both the primal and dual solutions.Parameters
- reductor
The reductor used to generate the reduced order models and estimate the output error.
- initial_guess
The
parameter valuescontaining an initial guess for the optimal parameter value.
Methods
Extend the current ROM for new
parameter valueswith primal and dual solutions.- extend(mu)[source]¶
Extend the current ROM for new
parameter valueswith primal and dual solutions.Parameters
- mu
The
Muinstance for which an extension is computed.
- class pymor.algorithms.tr.QuadraticOutputTRSurrogate(reductor, initial_guess, continuity_estimator_output, product_name=None)[source]¶
Bases:
BasicTRSurrogateSurrogate for
trust_regionwith only the primal enrichment naive output estimate.Note
This specialized TRSurrogate should soon be made obsolete when the quadratic output estimation is included into a reductor.
Parameters
- reductor
The reductor used to generate the reduced order models and estimate the output error.
- initial_guess
The
parameter valuescontaining an initial guess for the optimal parameter value.- continuity_estimator_output
Estimation for the continuity constant of the quadratic output functional.
- product_name
Name of the inner-product
Operatorof the ROM w.r.t. which the continuity constant for the output is estimated.
Methods
- class pymor.algorithms.tr.TRSurrogate(reductor, initial_guess, name=None)[source]¶
Bases:
pymor.core.base.BasicObjectBase class for
trust_regionsurrogates.Not to be used directly.
Methods
Accept the new ROM.
Reject the new ROM.
- pymor.algorithms.tr.coercive_rb_trust_region(reductor, primal_dual=False, parameter_space=None, initial_guess=None, beta=0.95, radius=0.1, shrink_factor=0.5, miniter=0, maxiter=30, miniter_subproblem=0, maxiter_subproblem=400, tol_criticality=1e-06, radius_tol=0.75, rtol_output=1e-16, rtol_mu=1e-16, tol_sub=1e-08, armijo_alpha=0.0001, line_search_params=None, stagnation_window=3, stagnation_threshold=np.inf, quadratic_output=False, quadratic_output_continuity_estimator=None, quadratic_output_product_name=None)[source]¶
Error aware trust-region method for a coercive RB model as surrogate.
See
trust_region.Parameters
- reductor
The reductor used to generate the reduced order models and estimate the output error.
- primal_dual
If
False, only enrich with the primal solution. IfTrue, additionally enrich with the dual solutions.- quadratic_output
Set to
Trueif output is given by a quadratic functional.- quadratic_output_continuity_estimator
In case of a quadratic output functional, a
ParameterFunctionalgiving an upper bound for the norm of the corresponding bilinear form.- quadratic_output_product_name
In case of a quadratic output functional, the name of the inner-product
Operatorof the ROM w.r.t. which the continuity constant for the output is estimated.
- pymor.algorithms.tr.trust_region(fom, surrogate, parameter_space=None, initial_guess=None, beta=0.95, radius=0.1, shrink_factor=0.5, miniter=0, maxiter=30, miniter_subproblem=0, maxiter_subproblem=400, tol_criticality=1e-06, radius_tol=0.75, rtol_output=1e-16, rtol_mu=1e-16, tol_sub=1e-08, armijo_alpha=0.0001, line_search_params=None, stagnation_window=3, stagnation_threshold=np.inf)[source]¶
Error-aware trust region algorithm.
This method solves the optimization problem
min J(mu), mu in C
for a model with an output \(J\) depending on a box-constrained
muusing an adaptive trust region method.The main idea for the algorithm can be found in [YM13], and an application to box-constrained parameters with possible enlarging of the trust radius in [KMO+21].
This method contrasts itself from
scipy.optimize.minimizein the computation of the trust region:scipyTR implementations use a metric distance, whereas this function uses an error estimator obtained from the surrogate. Additionally, the cheap model function surrogate here is only updated for each outer iteration, not entirely reconstructed.Parameters
- fom
The
Modelwith outputJused for the optimization.- surrogate
The
TRSurrogateused to generate the surrogate model and estimate the output error.- parameter_space
If not
None, theParameterSpacefor enforcing the box constraints on theparameter valuesmu. Otherwise aParameterSpacewith lower bound -1 and upper bound 1 is used.- initial_guess
If not
None,parameter valuescontaining an initial guess for the solutionmu. Otherwise, randomparameter valuesfrom theparameter_spaceare chosen as the initial value.- beta
The factor used to check if the current
parameter valuesare close to the trust region boundary.- radius
The radius of the initial trust region.
- shrink_factor
The factor by which the trust region is shrunk. If the trust region radius is increased, it is increased by
1. / shrink_factor.- miniter
Minimum amount of iterations to perform.
- maxiter
Fail if the iteration count reaches this value without converging.
- miniter_subproblem
Minimum amount of iterations to perform in the BFGS subproblem.
- maxiter_subproblem
Fail the BFGS subproblem if the iteration count reaches this value without converging.
- tol_criticality
Finish when the current
parameter valuesfulfill the approximate first order critical optimality condition with a value below this threshold.- radius_tol
Threshold for increasing the trust region radius upon extending the reduced order model.
- rtol_output
See
rtol_outputoferror_aware_bfgs.- rtol_mu
See
rtol_muoferror_aware_bfgs.- tol_sub
See
tol_suboferror_aware_bfgs.- armijo_alpha
Threshold for the constrained Armijo condition. See
constrained_armijo.- 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.
Returns
- mu
NumPy arraycontaining the computed optimalparameter values.- data
Dict containing additional information of the optimization call.
Raises
- TRError
Raised if the TR algorithm failed to converge.