17.1.1.11. pysisyphus.line_searches package

17.1.1.11.1. Submodules

17.1.1.11.2. pysisyphus.line_searches.Backtracking module

class pysisyphus.line_searches.Backtracking.Backtracking(*args, rho_lo=0.05, rho_hi=0.9, use_grad=False, **kwargs)[source]

Bases: LineSearch

__init__(*args, rho_lo=0.05, rho_hi=0.9, use_grad=False, **kwargs)[source]

Backtracking line search enforcing Armijo conditions.

Uses only energy evaluations.

See [1], Chapter 3, Line Search methods, Section 3.1 p. 31 and Section 3.5 p. 56.

alpha_new_from_phi(cycle, phi0, dphi0, alpha, alpha_prev)[source]
alpha_new_from_phi_dphi(cycle, phi0, dphi0, alpha)[source]

17.1.1.11.3. pysisyphus.line_searches.HagerZhang module

class pysisyphus.line_searches.HagerZhang.HagerZhang(*args, alpha_prev=None, f_prev=None, dphi0_prev=None, quad_step=False, eps=1e-06, theta=0.5, gamma=0.5, rho=5, psi_0=0.01, psi_1=0.1, psi_2=2.0, psi_low=0.1, psi_hi=10, Delta=0.7, omega=0.001, max_bisects=10, **kwargs)[source]

Bases: LineSearch

bisect(a, b)[source]

Bisect interval [a, b].

bracket(c)[source]

Generate initial interval [a, b] that satisfies the opposite slope condition (dphi(a) < 0, dphi(b) > 0).

double_secant(a, b)[source]

Take secant² step.

initial()[source]

Get an initial guess for alpha.

interval_update(a, b, c)[source]

Narrows down the bracketing interval.

norm_inf(arr)[source]

Returns infinity norm of given array.

secant(a, b)[source]

Take secant step.

take_quad_step(alpha, g0_)[source]

Try to get alpha for minimum step from quadratic interpolation.

17.1.1.11.4. pysisyphus.line_searches.LineSearch module

class pysisyphus.line_searches.LineSearch.LineSearch(p, cond='armijo', x0=None, geometry=None, f=None, df=None, alpha_init=None, f0=None, g0=None, c1=0.1, c2=0.9, max_cycles=10, alpha_min=1e-06)[source]

Bases: object

check_alpha(alpha)[source]
curvature_condition(alpha)[source]
get_fg(what, alpha)[source]

Lookup raw function/gradient values for a given alpha.

get_phi_dphi(what, alpha, check=True)[source]

Wrapper that handles function/gradient evaluations.

got_alpha_phi_dphi(alpha)[source]
log(message)[source]
run()[source]
strong_curvature_condition(alpha)[source]
strong_wolfe_condition(alpha)[source]

Strong wolfe condition.

sufficiently_decreased(alpha)[source]

Sufficient decrease/Armijo condition.

wolfe_condition(alpha)[source]

Normal, not strong, Wolfe condition.

exception pysisyphus.line_searches.LineSearch.LineSearchConverged(alpha)[source]

Bases: Exception

exception pysisyphus.line_searches.LineSearch.LineSearchNotConverged[source]

Bases: Exception

class pysisyphus.line_searches.LineSearch.LineSearchResult(converged, alpha, f_new, g_new, f_evals, df_evals, dphi0)

Bases: tuple

alpha

Alias for field number 1

converged

Alias for field number 0

df_evals

Alias for field number 5

dphi0

Alias for field number 6

f_evals

Alias for field number 4

f_new

Alias for field number 2

g_new

Alias for field number 3

17.1.1.11.5. pysisyphus.line_searches.StrongWolfe module

class pysisyphus.line_searches.StrongWolfe.StrongWolfe(*args, alpha_max=10.0, fac=2, **kwargs)[source]

Bases: LineSearch

__init__(*args, alpha_max=10.0, fac=2, **kwargs)[source]

Wolfe line search.

Uses only energy & gradient evaluations.

See [1], Chapter 3, Line Search methods, Section 3.5 p. 60.

zoom(alpha_lo, alpha_hi, phi_lo, phi_alpha_=None, alpha_0_=None, max_cycles=10)[source]

17.1.1.11.6. pysisyphus.line_searches.interpol module

pysisyphus.line_searches.interpol.interpol_alpha_cubic(f_0, df_0, f_alpha_0, f_alpha_1, alpha_0, alpha_1)[source]
pysisyphus.line_searches.interpol.interpol_alpha_quad(f_0, df_0, f_alpha_0, alpha_0)[source]

17.1.1.11.7. Module contents

class pysisyphus.line_searches.Backtracking(*args, rho_lo=0.05, rho_hi=0.9, use_grad=False, **kwargs)[source]

Bases: LineSearch

__init__(*args, rho_lo=0.05, rho_hi=0.9, use_grad=False, **kwargs)[source]

Backtracking line search enforcing Armijo conditions.

Uses only energy evaluations.

See [1], Chapter 3, Line Search methods, Section 3.1 p. 31 and Section 3.5 p. 56.

alpha_new_from_phi(cycle, phi0, dphi0, alpha, alpha_prev)[source]
alpha_new_from_phi_dphi(cycle, phi0, dphi0, alpha)[source]
class pysisyphus.line_searches.HagerZhang(*args, alpha_prev=None, f_prev=None, dphi0_prev=None, quad_step=False, eps=1e-06, theta=0.5, gamma=0.5, rho=5, psi_0=0.01, psi_1=0.1, psi_2=2.0, psi_low=0.1, psi_hi=10, Delta=0.7, omega=0.001, max_bisects=10, **kwargs)[source]

Bases: LineSearch

bisect(a, b)[source]

Bisect interval [a, b].

bracket(c)[source]

Generate initial interval [a, b] that satisfies the opposite slope condition (dphi(a) < 0, dphi(b) > 0).

double_secant(a, b)[source]

Take secant² step.

initial()[source]

Get an initial guess for alpha.

interval_update(a, b, c)[source]

Narrows down the bracketing interval.

norm_inf(arr)[source]

Returns infinity norm of given array.

secant(a, b)[source]

Take secant step.

take_quad_step(alpha, g0_)[source]

Try to get alpha for minimum step from quadratic interpolation.

class pysisyphus.line_searches.StrongWolfe(*args, alpha_max=10.0, fac=2, **kwargs)[source]

Bases: LineSearch

__init__(*args, alpha_max=10.0, fac=2, **kwargs)[source]

Wolfe line search.

Uses only energy & gradient evaluations.

See [1], Chapter 3, Line Search methods, Section 3.5 p. 60.

zoom(alpha_lo, alpha_hi, phi_lo, phi_alpha_=None, alpha_0_=None, max_cycles=10)[source]