cottax.consumers.execution.interface_types module

What a run takes, a Model; what a driver’s implementation is handed and returns: the problem Posed, the ConditionMap it tries values through, and the values it is written against.

class Model(*args, **kwargs)[source]

Bases: Protocol

A declared model as a run takes it: its plan’s graph and the values given with it.

graph: NestingGraph
given: Mapping[Place, Any]
type Unknowns = tuple[Any, ...]

One value per unknown of the node answered, in node.unknowns order.

type ConditionValues = tuple[Any, ...]

One value per condition of the node answered, in node.conditions order.

type Context = tuple[Any, ...]

What a condition map needs besides the unknowns: opaque, and passed on unchanged – args in optimistix and scipy.

type ByRole = Mapping[type[Role], tuple[Any, ...]]

Per role of the driver, one value per place of the role’s slot: the data it takes, or the reports it makes.

class ConditionMap[source]

Bases: Frozen

A condition node’s values as a function: unknowns tuple first, then context tuple.

See InteriorConditionMap for the common case.

class Posed[V: Place](condition: ConditionalNode[V], reports: tuple[type[Role], ...], conditions: ConditionMap, context_places: tuple[V, ...])[source]

Bases: Frozen, Generic[V]

The problem a driver implementation solves, all static: the condition node, the reports asked back, the condition map it tries values through, and where the context is read.

condition: ConditionalNode[V]

its unknowns, its conditions, and what they mean.

Type:

The condition node answered, without its driver

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

the driver’s reports.

Type:

The roles asked back

conditions: ConditionMap

the value at each of condition.reads, the conditions then the parameters, which the solve holds fixed.

Type:

conditions(unknowns, context)

context_places: tuple[V, ...]

a parameter among them.

Type:

Where each value of the context is read

fixed(places: tuple[V, ...], context: Context)[source]

The value of each of places in context, read with no unknown: a parameter an implementation needs before it tries any (an initial value, a span).

Return type:

tuple[Any, ...]