pdfo.uobyqa#

pdfo.uobyqa(fun, x0, args=(), options=None)[source]#

Unconstrained Optimization BY Quadratic Approximation.

Deprecated since version 1.3: Calling the UOBYQA solver via the uobyqa function is deprecated. The UOBYQA solver remains available in PDFO. Call the pdfo function with the argument method='uobyqa' to use it.

Parameters:
fun: callable

Objective function to be minimized.

fun(x, *args) -> float

where x is an array with shape (n,) and args is a tuple.

x0: ndarray, shape (n,)

Initial guess.

args: tuple, optional

Parameters of the objective function. For example,

pdfo(fun, x0, args, ...)

is equivalent to

pdfo(lambda x: fun(x, *args), x0, ...)

options: dict, optional

The options passed to the solver. It contains optionally:

rhobeg: float, optional

Initial value of the trust region radius, which should be a positive scalar. Typically, options['rhobeg'] should be in the order of one tenth of the greatest expected change to a variable. By default, it is 1.

rhoend: float, optional

Final value of the trust region radius, which should be a positive scalar. options['rhoend'] should indicate the accuracy required in the final values of the variables. Moreover, options['rhoend'] should be no more than options['rhobeg'] and is by default 1e-6.

maxfev: int, optional

Upper bound of the number of calls of the objective function fun. Its value must be not less than options['npt'] + 1. By default, it is 500 * n.

ftarget: float, optional

Target value of the objective function. If a feasible iterate achieves an objective function value lower or equal to `options['ftarget'], the algorithm stops immediately. By default, it is \(-\infty\).

quiet: bool, optional

Whether the interface is quiet. If it is set to True, the output message will not be printed. This flag does not interfere with the warning and error printing.

classical: bool, optional

Whether to call the classical Powell code or not. It is not encouraged in production. By default, it is False.

debug: bool, optional

Debugging flag. It is not encouraged in production. By default, it is False.

chkfunval: bool, optional

Flag used when debugging. If both options['debug'] and options['chkfunval'] are True, an extra function evaluation would be performed to check whether the returned values of objective function and constraint match the returned x. By default, it is False.

Returns:
res: OptimizeResult

The results of the solver. Check OptimizeResult for a description of the attributes.

See also

pdfo

Powell’s Derivative-Free Optimization solvers.

newuoa

NEW Unconstrained Optimization Algorithm.

bobyqa

Bounded Optimization BY Quadratic Approximations.

lincoa

LINearly Constrained Optimization Algorithm.

cobyla

Constrained Optimization BY Linear Approximations.

References

[1]

M. J. D. Powell. UOBYQA: unconstrained optimization by quadratic approximation. Math. Program., 92:555–582, 2002.

Examples

The following example shows how to solve a simple unconstrained optimization problem. The problem considered below should be solved with a derivative-based method. It is used here only as an illustration.

We consider the 2-dimensional problem

\[\min_{x, y \in \R} \quad x^2 + y^2.\]

We solve this problem using uobyqa starting from the initial guess \((x_0, y_0) = (0, 1)\) with at most 200 function evaluations.

>>> from pdfo import uobyqa
>>> options = {'maxfev': 200}
>>> res = uobyqa(lambda x: x[0]**2 + x[1]**2, [0, 1], options=options)
>>> res.x
array([0., 0.])