optiml.opti.unconstrained package

Subpackages

Submodules

Module contents

class optiml.opti.unconstrained.Rosenbrock(ndim=2, a=1, b=2)[source]

Bases: OptimizationFunction

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

The Rosenbrock function.

Parameters:

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

Returns:

the value of the Rosenbrock function at x.

args()
function_jacobian(*args, **kwargs)
hessian(x)

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.

jacobian(x)

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.

class optiml.opti.unconstrained.Ackley(ndim=2)[source]

Bases: OptimizationFunction

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

The Ackley function.

Parameters:

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

Returns:

the value of the Ackley function.

args()
function_jacobian(*args, **kwargs)
hessian(x)

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.

jacobian(x)

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.

class optiml.opti.unconstrained.SixHumpCamel(ndim=2)[source]

Bases: OptimizationFunction

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

The Six-Hump Camel function.

Parameters:

x – 1D array of points at which the Six-Hump Camel function is to be computed.

Returns:

the value of the Six-Hump Camel function.

args()
function_jacobian(*args, **kwargs)
hessian(x)

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.

jacobian(x)

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.

class optiml.opti.unconstrained.ProximalBundle(f, x=None, mu=1, m1=0.01, eps=1e-06, tol=1e-08, max_iter=1000, m_inf=-inf, callback=None, callback_args=(), master_solver='clarabel', master_verbose=False, random_state=None, verbose=False)[source]

Bases: Optimizer

Apply the Proximal Bundle Method for the minimization of the provided function f, which is assumed to be (possibly) nondifferentiable.

At each iteration a cutting-plane model of f is built from the subgradients collected so far and a stabilized master problem, regularized by a proximal term weighted by \(\mu\), is solved to compute the search direction; the candidate point is then accepted as a Serious Step or rejected as a Null Step according to an Armijo-like sufficient decrease condition.

Parameters:
  • f – the objective function.

  • x – ([n x 1] real column vector, optional): the point where to start the algorithm from; if not provided, the default starting point provided by f() is used.

  • mu – (real scalar, optional, default value 1): the fixed weight to be given to the stabilizing term throughout all the algorithm. It must be a strictly positive number.

  • m1 – (real scalar, optional, default value 0.01): parameter of the Armijo-like condition used to declare a Serious Step; has to be in (0,1).

  • eps – (real scalar, optional, default value 1e-6): the accuracy in the stopping criterion: the algorithm is stopped when the norm of the direction (optimal solution of the master problem) is less than or equal to mu * eps. If a negative value is provided, this is used in a relative stopping criterion: the algorithm is stopped when the norm of the direction is less than or equal to mu * (- eps) * || norm of the first gradient ||.

  • tol – (real scalar, optional, default value 1e-8): the tolerance used to check the optimality conditions when f is a Lagrangian dual relaxation.

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

  • m_inf – (real scalar, optional, default value -inf): if the algorithm determines a value for f() <= m_inf this is taken as an indication that the problem is unbounded below and computation is stopped (a “finite -inf”).

  • callback – (callable, optional, default value None): a function called at each iteration with the optimizer instance as first argument.

  • callback_args – (tuple, optional, default value ()): additional arguments passed to callback.

  • master_solver – (string, optional, default value ‘clarabel’): the cvxpy solver used to solve the master problem at each iteration.

  • master_verbose – (boolean, optional, default value False): print details about the resolution of the master problem if True, nothing otherwise.

  • random_state – (integer scalar, optional, default value None): seed for the random number generator used to initialize the starting point when x is not provided.

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

Return x:

([n x 1] real column vector): the best solution found so far.

Return status:

(string): the status of the algorithm at termination, one of: optimal (x is a(n approximately) optimal solution), unbounded (f() was driven below m_inf, i.e., the problem looks unbounded below), stopped (the maximum number of iterations was reached) or error (the master problem could not be solved at some iteration).

minimize()[source]
callback(args=())
check_lagrangian_dual_conditions()
check_lagrangian_dual_optimality()
is_augmented_lagrangian_dual()
is_lagrangian_dual()
is_verbose()