modopt.line_search_algorithms

modopt.line_search_algorithms.BacktrackingArmijo(...)

Backtracking line search for steps that satisy the Armijo condition.

modopt.line_search_algorithms.Minpack2LS(...)

The Minpack2 line search algorithm for steps that satisfy the strong Wolfe conditions.

class modopt.line_search_algorithms.BacktrackingArmijo(**kwargs)[source]

Backtracking line search for steps that satisy the Armijo condition.

Parameters
fcallable

Merit function.

gcallable

Gradient of the merit function.

eta_afloat, default=1e-4

Armijo parameter.

gamma_cfloat, default=0.3

Step length contraction factor.

maxiterint, default=25

Maximum number of line search iterations.

max_stepfloat, default=1.

Maximum step length.

Methods

search(x, p[, f0, g0])

Perform a backtracking line search to find a step length that satisfies the Armijo condition.

search(x, p, f0=None, g0=None)[source]

Perform a backtracking line search to find a step length that satisfies the Armijo condition.

Parameters
xnp.ndarray

Current point.

pnp.ndarray

Search direction.

f0float, optional

Value of the merit function at the current point.

g0np.ndarray, optional

Gradient of the merit function at the current point.

Returns
alphafloat

Step length found by the line search.

f2float

Value of the merit function at the new point.

nfevint

Number of additional function evaluations.

ngevint

Number of additional gradient evaluations.

convergedbool

True if the line search converged to a step length that satisfies the Armijo condition, False otherwise.

class modopt.line_search_algorithms.Minpack2LS(**kwargs)[source]

The Minpack2 line search algorithm for steps that satisfy the strong Wolfe conditions.

Parameters
fcallable

Merit function.

gcallable

Gradient of the merit function.

eta_afloat, default=1e-4

Armijo parameter.

eta_wfloat, default=0.9

Wolfe parameter.

max_stepfloat, default=1.

Maximum step length.

min_stepfloat, default=1e-12

Minimum step length.

maxiterint, default=10

Maximum number of line search iterations.

alpha_tolfloat, default=1e-14

Relative tolerance for an acceptable step.

Methods

search(x, p[, f0, g0])

Perform a line search to find a step length that satisfies the strong Wolfe conditions.

search(x, p, f0=None, g0=None)[source]

Perform a line search to find a step length that satisfies the strong Wolfe conditions.

Parameters
xnp.ndarray

Current point.

pnp.ndarray

Search direction.

f0float, optional

Value of the merit function at the current point.

g0np.ndarray, optional

Gradient of the merit function at the current point.

Returns
alphafloat

Step length found by the line search.

f2float

Value of the merit function at the new point.

g2np.ndarray

Gradient of the merit function at the new point.

slope2float

Slope of the merit function at the new point along the search direction.

nfevint

Number of additional function evaluations.

ngevint

Number of additional gradient evaluations.

convergedbool

True if the line search converged to a step length that satisfies the strong Wolfe conditions, False otherwise.