optiml.opti package

Subpackages

Submodules

Module contents

class optiml.opti.Optimizer(f, x=None, eps=1e-06, tol=1e-08, max_iter=1000, callback=None, callback_args=(), random_state=None, verbose=False)[source]

Bases: ABC

Parameters:
  • f – the objective function.

  • x – ([n x 1] real column vector): 1D array of points at which the Hessian is to be computed.

  • eps – (real scalar, optional, default value 1e-6): the accuracy in the stopping criterion: the algorithm is stopped when the norm of the gradient is less than or equal to eps.

  • max_iter – (integer scalar, optional, default value 1000): the maximum number of iterations.

  • verbose – (boolean, optional, default value False): print details about each iteration if True, nothing otherwise.

is_lagrangian_dual()[source]
is_augmented_lagrangian_dual()[source]
callback(args=())[source]
check_lagrangian_dual_optimality()[source]
check_lagrangian_dual_conditions()[source]
is_verbose()[source]
minimize()[source]
class optiml.opti.OptimizationFunction(ndim=2)[source]

Bases: ABC

x_star()[source]
f_star()[source]
args()[source]
function(x)[source]
jacobian(x)[source]

The Jacobian (i.e., the gradient) of the function.

Parameters:

x – 1D array of points at which the Jacobian is to be computed.

Returns:

the Jacobian of the function at x.

function_jacobian(*args, **kwargs)[source]
hessian(x)[source]

The Hessian matrix of the function.

Parameters:

x – 1D array of points at which the Hessian is to be computed.

Returns:

the Hessian matrix of the function at x.

class optiml.opti.Quadratic(Q, q)[source]

Bases: OptimizationFunction

Construct a quadratic function from its linear and quadratic part defined as

\[\tfrac{1}{2} x^\top Q x + q^\top x\]
Parameters:
  • Q – ([n x n] real symmetric matrix, not necessarily positive semidefinite): the Hessian (i.e., the quadratic part) of f. If it is not positive semidefinite, f(x) will be unbounded below.

  • q – ([n x 1] real column vector): the linear part of f.

x_star()[source]
f_star()[source]
function(x)[source]

A general quadratic function \(f(x) = \tfrac{1}{2} x^\top Q x + q^\top x\).

Parameters:

x – ([n x 1] real column vector): 1D array of points at which the Hessian is to be computed.

Returns:

the value \(\tfrac{1}{2} x^\top Q x + q^\top x\) of the general quadratic function at x.

jacobian(x)[source]

The Jacobian (i.e., the gradient) of a general quadratic function \(J f(x) = Q x + q\).

Parameters:

x – ([n x 1] real column vector): 1D array of points at which the Jacobian is to be computed.

Returns:

the Jacobian of a general quadratic function.

hessian(x)[source]

The Hessian matrix of a general quadratic function \(H f(x) = Q\).

Parameters:

x – 1D array of points at which the Hessian is to be computed.

Returns:

the Hessian matrix (i.e., the quadratic part) of a general quadratic function at x.

args()
function_jacobian(*args, **kwargs)