AbstractBoundedMinimizer

class pmrf.optimize.AbstractBoundedMinimizer

Bases: Module

Abstract interface for bounded minimization algorithms.

A minimiser that honours bounds (honours_bounds) searches box space, the box of the parameters’ bounds, and is given its edges as bounds. One that does not, such as a backend configured with an unbounded method, moves through raw space instead and is given no bounds.

abstractmethod run(fn: Callable[[PyTree, Any], Shaped[jaxlib._jax.Array, '']], y0: PyTree, args: Any, bounds: tuple[PyTree, PyTree] | None = None, max_iter: int = 1024, **kwargs) → MinimizeResult

Execute the minimization algorithm.

Parameters:
  • fn (callable) – The objective function to minimize.

  • y0 (PyTree) – The initial parameter guess.

  • args (Any) – Args to pass to fn.

  • bounds (tuple[PyTree, PyTree], optional) – The lower and upper edges of the box to search, shaped like y0, or None if the minimiser does not honour bounds. Edges may be infinite.

  • max_iter (int = 1024) – The maximum number of iterations to take.

  • **kwargs – Runtime arguments forward to the solver backend.

Returns:

An instance of pmrf.optimize.MinimizeResult.

Return type:

results

property honours_bounds: bool

Whether the minimiser keeps its values inside the bounds it is given.

True by default. A subclass whose backend can ignore bounds overrides it.