minimize_constr(method=’l-bfgs-b’)¶
-
torchmin.constrained.lbfgsb._minimize_lbfgsb(fun, x0, bounds=None, lr=1.0, history_size=10, max_iter=None, gtol=1e-05, ftol=1e-09, normp=inf, callback=None, disp=0, return_all=False)[source]¶ Minimize a scalar function with L-BFGS-B.
L-BFGS-B 1 is a limited-memory quasi-Newton method for bound-constrained optimization. It extends L-BFGS to handle box constraints.
- Parameters
fun (callable) – Scalar objective function to minimize.
x0 (Tensor) – Initialization point.
bounds (tuple of Tensor, optional) – Bounds for variables as (lb, ub) where lb and ub are Tensors of the same shape as x0. Use float(‘-inf’) and float(‘inf’) for unbounded variables. If None, equivalent to unbounded.
lr (float) – Step size for parameter updates (used as initial step in line search).
history_size (int) – History size for L-BFGS Hessian estimates.
max_iter (int, optional) – Maximum number of iterations. Defaults to 200 * x0.numel().
gtol (float) – Termination tolerance on projected gradient norm.
ftol (float) – Termination tolerance on function/parameter changes.
normp (Number or str) – Norm type for termination conditions. Can be any value supported by torch.norm.
callback (callable, optional) – Function to call after each iteration: callback(x).
disp (int or bool) – Display (verbosity) level. Set to >0 to print status messages.
return_all (bool, optional) – Set to True to return a list of the best solution at each iteration.
- Returns
result – Result of the optimization routine.
- Return type
OptimizeResult
References
- 1
Byrd, R. H., Lu, P., Nocedal, J., & Zhu, C. (1995). A limited memory algorithm for bound constrained optimization. SIAM Journal on Scientific Computing, 16(5), 1190-1208.