linesearch⚓︎
Line-search-based deterministic optimization methods.
This module implements gradient-based algorithms that share a common line search interface, including gradient descent, BFGS, and Newton-CG.
LineSearch
⚓︎
Bases: OptimizerBase
Line-search optimizer compatible with OptimizerBase.
The class supports gradient descent, BFGS, and Newton-CG search directions, together with either Wolfe or backtracking line search. It can operate with bounds, optional state transformations, logging, result persistence, and restart checkpoints.
__init__(x0, fun, method='GD', jac=None, hess=None, args=(), bounds=None, callback=None, **options)
⚓︎
Initialize a line-search optimizer instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x0
|
ndarray
|
Initial parameter vector. |
required |
fun
|
callable
|
Objective function. |
required |
method
|
(GD, BFGS, Newton - CG)
|
Search-direction method. |
'GD'
|
jac
|
callable
|
Gradient function. |
None
|
hess
|
callable
|
Hessian function, required by |
None
|
args
|
tuple
|
Extra positional arguments passed to the wrapped callables. |
()
|
bounds
|
sequence
|
Lower and upper bounds for each state variable. |
None
|
callback
|
callable
|
Callback invoked after successful updates. |
None
|
**options
|
Line-search configuration, plus everything :class: |
{}
|
log_columns()
⚓︎
The row of the iteration log: iteration, objective, gradient infinity norm, step length taken.
update_step()
⚓︎
Perform one optimization step.
The method computes a search direction, performs a line search, and commits the new iterate on success. When enabled, it can recompute the gradient and retry if the line search fails.