desc.optimize.lsq_auglag
- class desc.optimize.lsq_auglag(fun, x0, jac, bounds=(-inf, inf), constraint=None, args=(), x_scale=1, ftol=1e-06, xtol=1e-06, gtol=1e-06, ctol=1e-06, verbose=1, maxiter=None, callback=None, options={})Source
Minimize a function with constraints using an augmented Lagrangian method.
The objective function is assumed to be vector valued, and is minimized in the least squares sense.
- Parameters:
fun (callable) – objective to be minimized. Should have a signature like fun(x,*args)-> 1d array
x0 (array-like) – initial guess
jac (callable:) – function to compute Jacobian matrix of fun
bounds (tuple of array-like) – Lower and upper bounds on independent variables. Defaults to no bounds. Each array must match the size of x0 or be a scalar, in the latter case a bound will be the same for all variables. Use np.inf with an appropriate sign to disable bounds on all or some variables.
constraint (scipy.optimize.NonlinearConstraint) – constraint to be satisfied
args (tuple) – additional arguments passed to fun, grad, and hess
x_scale (array_like or
'hess', optional) – Characteristic scale of each variable. Settingx_scaleis equivalent to reformulating the problem in scaled variablesxs = x / x_scale. An alternative view is that the size of a trust region along jth dimension is proportional tox_scale[j]. Improved convergence may be achieved by settingx_scalesuch that a step of a given size along any of the scaled variables has a similar effect on the cost function. If set to'hess', the scale is iteratively updated using the inverse norms of the columns of the Hessian matrix.ftol (float or None, optional) – Tolerance for termination by the change of the cost function. The optimization process is stopped when
dF < ftol * F, and there was an adequate agreement between a local quadratic model and the true model in the last step. If None, the termination by this condition is disabled.xtol (float or None, optional) – Tolerance for termination by the change of the independent variables. Optimization is stopped when
norm(dx) < xtol * (xtol + norm(x)). If None, the termination by this condition is disabled.gtol (float or None, optional) – Absolute tolerance for termination by the norm of the gradient. Optimizer terminates when
norm(g) < gtol, where If None, the termination by this condition is disabled.ctol (float, optional) – Tolerance for stopping based on infinity norm of the constraint violation. Optimizer terminates when
max(abs(constr_violation)) < ctolAND one or more of the other tolerances are met (ftol,xtol,gtol)verbose ({0, 1, 2}, optional) –
0 (default) : work silently.
1 : display a termination report.
2 : display progress during iterations
maxiter (int, optional) – maximum number of iterations. Defaults to size(x)*100
callback (callable, optional) –
Called after each iteration. Should be a callable with the signature:
callback(xk, *args) -> boolwhere
xkis the current parameter vector, andargsare the same arguments passed to fun and jac. If callback returns True the algorithm execution is terminated.options (dict, optional) – dictionary of optional keyword arguments to override default solver settings. See the code for more details.
- Returns:
res (OptimizeResult) – The optimization result represented as a
OptimizeResultobject. Important attributes are:xthe solution array,successa Boolean flag indicating if the optimizer exited successfully.