verry.optimize.branchbound#

verry.optimize.branchbound(fun, domain, fprime=True, xtol=inf, ytol=0.0, max_iter=16)#

Find the minimum of the multivariate scalar-valued function by repeatedly dividing the interval vector.

Parameters:
  • fun (Callable) – Function to be optimized.

  • domain (IntervalMatrix) – Interval vector in which to search for the minimum value.

  • fprime (Callable | bool, optional) – Gradient of fun (the default is grad(fun)). If fprime is False, The differentiability of fun is not assumed.

  • xtol (default=inf) – Absolute tolerance.

  • ytol (default=0.0) – Relative tolerance.

  • max_iter (int, default=16) – Maximum number of iterations.

Returns:

  • r0 (Interval) – Interval containing the minimum value.

  • r1 (list[IntervalMatrix]) – Interval vectors at which fun may take a minimum value.

Warning

fun must be a \(C^1\)-function on domain if fprime is not False. Futhermore, fun must neither be a constant nor contain conditional branches (cf. Common pitfalls).

Examples

>>> from verry.linalg import FloatIntervalMatrix as FIM
>>> y, x = branchbound(lambda x, y: x**2 + y, FIM(inf=[-2, -1], sup=[1, 2]))
>>> print(format(y, ".3f"))
[-1.000, -0.999]