modopt.approximate_hessians

modopt.approximate_hessians.BFGS(**kwargs)

Broyden-Fletcher-Goldfarb-Shanno (BFGS) Hessian update.

modopt.approximate_hessians.BFGSScipy(**kwargs)

Broyden-Fletcher-Goldfarb-Shanno (BFGS) Hessian update using SciPy's BFGS implementation.

modopt.approximate_hessians.SR1(**kwargs)

Symmetric rank-one (SR1) Hessian update.

modopt.approximate_hessians.DFP(**kwargs)

Davidon-Fletcher-Powell (DFP) Hessian update.

modopt.approximate_hessians.PSB(**kwargs)

Powell-Symmetric-Broyden (PSB) Hessian update.

class modopt.approximate_hessians.BFGS(**kwargs)[source]

Broyden-Fletcher-Goldfarb-Shanno (BFGS) Hessian update.

Parameters
nxint

Number of optimization variables.

store_hessianbool, default=True

Store the Hessian approximation.

store_inversebool, default=False

Store the inverse Hessian approximation.

Attributes
B_knp.ndarray

Hessian approximation of shape (nx, nx). Available only if store_hessian is True.

M_knp.ndarray

Inverse Hessian approximation of shape (nx, nx). Available only if store_inverse is True.

Methods

update(d, w)

Update the stored Hessian approximation B_k or its inverse M_k using the BFGS formula.

update(d, w)[source]

Update the stored Hessian approximation B_k or its inverse M_k using the BFGS formula. The update is performed using the step d and the gradient difference w.

Parameters
dnp.ndarray

Step taken in the optimization space.

wnp.ndarray

Gradient difference along the step d.

class modopt.approximate_hessians.BFGSScipy(**kwargs)[source]

Broyden-Fletcher-Goldfarb-Shanno (BFGS) Hessian update using SciPy’s BFGS implementation.

Parameters
nxint

Number of optimization variables.

store_hessianbool, default=True

Store the Hessian approximation.

store_inversebool, default=False

Store the inverse Hessian approximation.

min_curvaturefloat, default=0.0

Curvature below which exception_strategy is triggered. Default is 1e-8 when exception_strategy = 'skip_update' and 0.2 when exception_strategy = 'damp_update'.

exception_strategy{‘skip_update’, ‘damp_update’}, default=’damp_update’

Strategy to proceed when the min_curvature condition is violated.

  • ‘skip_update’: Skip the update and keep the previous approximation.

  • ‘damp_update’: Interpolate between the computed BFGS update and the previous approximation.

init_scale{float, ‘auto’, np.ndarray}, default=’auto’

Initial scaling for the Hessian approximation. - float: Use init_scale*np.eye(nx) as the initial approximation. - ‘auto’: Use an automatic heuristic to compute the initial scaling factor. - np.ndarray: Use the provided array as the initial approximation. The array must be of shape (nx, nx), symmetric, and positive definite. Note that this option only works for SciPy >= 1.14.0.

Attributes
B_knp.ndarray

Hessian approximation of shape (nx, nx). Available only if store_hessian is True.

M_knp.ndarray

Inverse Hessian approximation of shape (nx, nx). Available only if store_inverse is True.

Methods

update(d, w)

Update the stored Hessian approximation B_k or its inverse M_k using the BFGS formula.

update(d, w)[source]

Update the stored Hessian approximation B_k or its inverse M_k using the BFGS formula. The update is performed using the step d and the gradient difference w.

Parameters
dnp.ndarray

Step taken in the optimization space.

wnp.ndarray

Gradient difference along the step d.

class modopt.approximate_hessians.SR1(**kwargs)[source]

Symmetric rank-one (SR1) Hessian update.

Parameters
nxint

Number of optimization variables.

Attributes
B_knp.ndarray

Hessian approximation of shape (nx, nx).

Methods

update(d, w)

Update the stored Hessian approximation B_k using the SR1 formula.

update(d, w)[source]

Update the stored Hessian approximation B_k using the SR1 formula. The update is performed using the step d and the gradient difference w.

Parameters
dnp.ndarray

Step taken in the optimization space.

wnp.ndarray

Gradient difference along the step d.

class modopt.approximate_hessians.DFP(**kwargs)[source]

Davidon-Fletcher-Powell (DFP) Hessian update.

Parameters
nxint

Number of optimization variables.

store_hessianbool, default=False

Store the Hessian approximation.

store_inversebool, default=True

Store the inverse Hessian approximation.

Attributes
B_knp.ndarray

Hessian approximation of shape (nx, nx). Available only if store_hessian is True.

M_knp.ndarray

Inverse Hessian approximation of shape (nx, nx). Available only if store_inverse is True.

Methods

update(d, w)

Update the stored Hessian approximation B_k or its inverse M_k using the DFP formula.

update(d, w)[source]

Update the stored Hessian approximation B_k or its inverse M_k using the DFP formula. The update is performed using the step d and the gradient difference w.

Parameters
dnp.ndarray

Step taken in the optimization space.

wnp.ndarray

Gradient difference along the step d.

class modopt.approximate_hessians.PSB(**kwargs)[source]

Powell-Symmetric-Broyden (PSB) Hessian update.

Parameters
nxint

Number of optimization variables.

Attributes
B_knp.ndarray

Hessian approximation of shape (nx, nx).

Methods

update(d, w)

Update the stored Hessian approximation B_k using the PSB formula.

update(d, w)[source]

Update the stored Hessian approximation B_k using the PSB formula. The update is performed using the step d and the gradient difference w.

Parameters
dnp.ndarray

Step taken in the optimization space.

wnp.ndarray

Gradient difference along the step d.