cottax.relational.consumers.execution.jax_solvers.optimistix module

Newton, Picard and BFGS: optimistix answering a RootFinder, a FixedPointIterator and a Minimiser.

class Optimistix[D: DriverContract](rtol: float = 0.0001, atol: float = 0.0001, max_steps: int = 256)[source]

Bases: DriverImplementation[D], Generic[D]

An optimistix solve from a Start, reporting its Steps. The unknowns are optimistix’s y as they are, a tuple, and the context its args.

needs: AbstractClassVar[frozenset[type[Role]]] = frozenset({<class 'cottax.core.driven.roles.Start'>})
provides: AbstractClassVar[frozenset[type[Role]]] = frozenset({<class 'cottax.core.driven.roles.Steps'>})
rtol: float = 0.0001
atol: float = 0.0001
max_steps: int = 256
abstractmethod solve[V: Place](posed: Posed[V], context: Context, data: ByRole)[source]

The optimistix solve answering posed: its function takes args=(posed, context).

Return type:

Solution

type Args = tuple[Posed, Context]

What each solver function is handed besides the unknowns: the static half, then the values.

class Newton(rtol: float = 0.0001, atol: float = 0.0001, max_steps: int = 256)[source]

Bases: Optimistix[RootFinder]

optx.Newton on the equality residuals, as many numbers as the unknowns.

solve[V: Place](posed: Posed[V], context: Context, data: ByRole)[source]

The optimistix solve answering posed: its function takes args=(posed, context).

Return type:

Solution

implements

alias of RootFinder

class Picard(rtol: float = 0.0001, atol: float = 0.0001, max_steps: int = 256)[source]

Bases: Optimistix[FixedPointIterator]

optx.FixedPointIteration: u <- g(u), no Jacobian taken.

solve[V: Place](posed: Posed[V], context: Context, data: ByRole)[source]

The optimistix solve answering posed: its function takes args=(posed, context).

Return type:

Solution

implements

alias of FixedPointIterator

class BFGS(rtol: float = 0.0001, atol: float = 0.0001, max_steps: int = 256)[source]

Bases: Optimistix[Minimiser]

optx.BFGS on the one objective.

solve[V: Place](posed: Posed[V], context: Context, data: ByRole)[source]

The optimistix solve answering posed: its function takes args=(posed, context).

Return type:

Solution

implements

alias of Minimiser