cottax.relational.contracts module

Driver contracts:

  1. Generic levels: RootFinder, FixedPointIterator, Minimiser, ConstrainedMinimiser.

  2. Finals over these levels with steps: RootFinding, FixedPointIteration, Minimisation, ConstrainedMinimisation.

  3. CONTRACTS, the defaults: one of each final, without steps.

class RootFinder[V: Place][source]

Bases: DriverContract[V], Generic[V]

Answers equalities, a fixed point among them.

static accepts(node: object)

No objective, every relation an equality. is_fixed_point / is_root_find.

Return type:

bool

is_iteration(node: object)[source]

A fixed point with each unknown on the left of exactly one relation: one update u <- g(u) per unknown.

Return type:

bool

class FixedPointIterator[V: Place][source]

Bases: DriverContract[V], Generic[V]

Answers u = g(u) by updating each unknown to its g(u).

static accepts(node: object)

A fixed point with each unknown on the left of exactly one relation: one update u <- g(u) per unknown.

Return type:

bool

class Minimiser[V: Place][source]

Bases: DriverContract[V], Generic[V]

Answers one objective with no relation beside it.

static accepts(node: object)

An optimise with no relation beside the objective.

Return type:

bool

class ConstrainedMinimiser[V: Place][source]

Bases: DriverContract[V], Generic[V]

Answers one objective, with or without relations to respect.

static accepts(node: object)

Exactly one objective. is_unconstrained_optimise / is_constrained_optimise.

Return type:

bool

class RootFinding[V: Place](steps: bool)[source]

Bases: RootFinder[V], Generic[V]

From a Start; steps reports Steps.

steps: bool
property takes: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property reports: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

class FixedPointIteration[V: Place](steps: bool)[source]

Bases: FixedPointIterator[V], Generic[V]

From a Start; steps reports Steps.

steps: bool
property takes: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property reports: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

class Minimisation[V: Place](steps: bool)[source]

Bases: Minimiser[V], Generic[V]

From a Start; steps reports Steps.

steps: bool
property takes: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property reports: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

class ConstrainedMinimisation[V: Place](steps: bool)[source]

Bases: ConstrainedMinimiser[V], Generic[V]

From a Start; steps reports Steps. Its bounds are relations of the problem over parameters, not data of the driver: they change the answer.

steps: bool
property takes: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

property reports: tuple[type[Role], ...]

abstract to ABC until a subclass binds the name, and absent on a class that declares it as a field.

Type:

What the level binds in place of the annotation

CONTRACTS = (RootFinding(), FixedPointIteration(), Minimisation(), ConstrainedMinimisation())

an implementation answers a problem by the first one it implements.

Type:

The default contracts