pymor.algorithms.tr

Module Contents

class pymor.algorithms.tr.BasicTRSurrogate(reductor, initial_guess, name=None)[source]

Bases: TRSurrogate

Surrogate for trust_region only 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 values containing an initial guess for the optimal parameter value.

Methods

extend

Extend the current ROM for new parameter values.

extend(mu)[source]

Extend the current ROM for new parameter values.

Parameters

mu

The Mu instance for which an extension is computed.

class pymor.algorithms.tr.PrimalDualTRSurrogate(reductor, initial_guess, name=None)[source]

Bases: TRSurrogate

Surrogate for trust_region enriching 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 values containing an initial guess for the optimal parameter value.

Methods

extend

Extend the current ROM for new parameter values with primal and dual solutions.

extend(mu)[source]

Extend the current ROM for new parameter values with primal and dual solutions.

Parameters

mu

The Mu instance for which an extension is computed.

class pymor.algorithms.tr.QuadraticOutputTRSurrogate(reductor, initial_guess, continuity_estimator_output, product_name=None)[source]

Bases: BasicTRSurrogate

Surrogate for trust_region with 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 values containing 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 Operator of the ROM w.r.t. which the continuity constant for the output is estimated.

estimate_output_error(mu)[source]
class pymor.algorithms.tr.TRSurrogate(reductor, initial_guess, name=None)[source]

Bases: pymor.core.base.BasicObject

Base class for trust_region surrogates.

Not to be used directly.

Methods

accept

Accept the new ROM.

estimate_output_error

extend

new_output

output

output_d_mu

rb_size

reject

Reject the new ROM.

accept()[source]

Accept the new ROM.

This function is intended to be called after extend was called.

estimate_output_error(mu)[source]
abstract extend(mu)[source]
new_output(mu)[source]
output(mu)[source]
output_d_mu(mu)[source]
rb_size()[source]
reject()[source]

Reject the new ROM.

This function is intended to be called after extend was called.

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. If True, additionally enrich with the dual solutions.

quadratic_output

Set to True if output is given by a quadratic functional.

quadratic_output_continuity_estimator

In case of a quadratic output functional, a ParameterFunctional giving 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 Operator of 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 mu using 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.minimize in the computation of the trust region: scipy TR 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 Model with output J used for the optimization.

surrogate

The TRSurrogate used to generate the surrogate model and estimate the output error.

parameter_space

If not None, the ParameterSpace for enforcing the box constraints on the parameter values mu. Otherwise a ParameterSpace with lower bound -1 and upper bound 1 is used.

initial_guess

If not None, parameter values containing an initial guess for the solution mu. Otherwise, random parameter values from the parameter_space are chosen as the initial value.

beta

The factor used to check if the current parameter values are 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 values fulfill 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_output of error_aware_bfgs.

rtol_mu

See rtol_mu of error_aware_bfgs.

tol_sub

See tol_sub of error_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_threshold during the last stagnation_window iterations.

stagnation_threshold

See stagnation_window.

Returns

mu

NumPy array containing the computed optimal parameter values.

data

Dict containing additional information of the optimization call.

Raises

TRError

Raised if the TR algorithm failed to converge.