Iteration(method, method_options=None, compute_jacobian=False)¶
Configuration for solving fixed point problems.
method (str or callable) –
The fixed point iteration routine that will be used. The following routines do not use analytic Jacobians:
'simple'- Non-accelerated iteration.
'squarem'- SQUAREM acceleration method of Varadhan and Roland (2008) and considered in the context of the BLP problem in Reynaerts, Varadhan, and Nash (2012). This implementation uses a first-order squared non-monotone extrapolation scheme. If there are any errors during the acceleration step, it uses the last values for the next iteration of the algorithm.
'broyden1'- Use the
scipy.optimize.root()Broyden’s first Jacobian approximation method, known as Broyden’s good method.
'broyden2'- Use the
scipy.optimize.root()Broyden’s second Jacobian approximation method, known as Broyden’s bad method.
'anderson'- Use the
'krylov'- Use the
scipy.optimize.root()Krylov approximation for inverse Jacobian method.
'diagbroyden'- Use the
scipy.optimize.root()diagonal Broyden Jacobian approximation method.
'df-sane'- Use the
scipy.optimize.root()derivative-free spectral method.
The following routines can use analytic Jacobians:
The following trivial routine can be used to simply return the initial values:
'return'- Assume that the initial values are the optimal ones.
Also accepted is a custom callable method with the following form:
method(initial, contraction, callback, **options) -> (final, converged)
initialis an array of initial values,
contractionis a callable contraction mapping of the form specified below,
callbackis a function that should be called without any arguments after each major iteration (it is used to record the number of major iterations),
optionsare specified below,
finalis an array of final values, and
convergedis a flag for whether the routine converged.
contractionfunction has the following form:
contraction(x0) -> (x1, weights, jacobian)
Noneor a vector of weights that should multiply
x1 - xbefore computing the norm of the differences, and
Regardless of the chosen routine, if there are any computational issues that create infinities or null values,
finalwill be the second to last iteration’s values.
method_options (dict, optional) –
Options for the fixed point iteration routine.
For routines other and
'return', these options will be passed to
scipy.optimize.root(). Refer to the SciPy documentation for information about which options are available. By default, the
tol_normoption is configured to use the infinity norm for SciPy methods other than
'lm', for which a norm cannot be specified.
'squarem'methods support the following options:
max_evaluations : (int) - Maximum number of contraction mapping evaluations. The default value is
atol : (float) - Absolute tolerance for convergence of the configured norm. The default value is
1e-14. To use only a relative tolerance, set this to zero.
rtol (float) - Relative tolerance for convergence of the configured norm. The default value is zero; that is, only absolute tolerance is used by default.
norm : (callable) - The norm to be used. By default, the \(\ell^\infty\)-norm is used. If specified, this should be a function that accepts an array of differences and that returns a scalar norm.
'squarem'routine accepts additional options that mirror those in the SQUAREM package, written in R by Ravi Varadhan, which identifies the step length with \(-\alpha\) from Varadhan and Roland (2008):
scheme : (int) - The default value is
3, which corresponds to S3 in Varadhan and Roland (2008). Other acceptable schemes are
2, which correspond to S1 and S2.
step_min : (float) - The initial value for the minimum step length. The default value is
step_max : (float) - The initial value for the maximum step length. The default value is
step_factor : (float) - When the step length exceeds
step_max, it is set equal to
step_maxis scaled by this factor. Similarly, if
step_minis negative and the step length is below
step_min, it is set equal to
step_minis scaled by this factor. The default value is
compute_jacobian (bool, optional) – Whether to compute an analytic Jacobian during iteration, which must be
methoddoes not use analytic Jacobians. By default, analytic Jacobians are not computed, and if a
methodis selected that supports analytic Jacobians, they will by default be numerically approximated.