cottax.consumers.execution.part module¶
Driving and Running: driving a model’s problems, and running it on values written by name or read from a caller’s structures, as a surface’s methods.
- class Driving(locator: Locator[V, N])[source]¶
Bases:
PartDriving problems: one by its contract (assign), or every undriven one by the first of the implementations accepting it (drive), tried under contracts; each role where role_places puts it.
- contracts: AbstractVar[tuple[DriverContract, ...]]¶
The contracts a problem is driven under, the first an implementation implements.
- role_places: AbstractVar[RolePlaces]¶
Where a driver’s data and reports go, a rule per role.
- assign(problem: Label, contract: DriverContract)[source]¶
The problem driven by contract, each of its roles where role_places puts it, read off the problem when the op is applied.
- Return type:
- class Results(values: OrderedMap, surface: Surface, graph: NestingGraph)[source]¶
Bases:
MappingEvery place’s value after a run, read by any name the surface reads: out[‘y_1’], out[V.y_1], or the place itself; a driver’s datum or report by role at an unknown, out[Trajectory, ‘x’]. out.into(state) writes them into a structure, out.into(history, Trajectory) a role’s at each unknown’s place.
- class Running(locator: Locator[V, N])[source]¶
Bases:
PartA model run on values written by name (values) or read from a caller’s structures (read_from), each keyed by Inputs or a driver’s role: run(model, values, read_from), through valued. A datum of a per-unknown role is read in a structure at its unknown’s place, or, the unknown a copy by this surface’s copies, at what it copies.
- copies: AbstractVar[PlaceToPlace]¶
a copy’s datum is read at what it copies.
- Type:
Where a cut’s copy of a place goes
- valued(model: NestingGraph | ProvedGraph | Model, values: Mapping[type, Mapping[Any, Any]] = OrderedMap(), read_from: Mapping[type, Any] = OrderedMap(), *, proof: type = CallableGraph)[source]¶
model (a graph, a proof, or a Model: a Declared), proved a proof unless it is one, with a value at each boundary input, from exactly one source: the declaration’s own values; values, by name, {Inputs: {‘x’: 1.}, Start: {‘z_1’: 5., s.copy(‘y_2’): 1.}}, a driver’s data by role and unknown, a per-problem role at any one unknown of its problem; or read_from, a structure per key, {Inputs: state, Start: state}. Refused: a value nothing reads, a place given twice, a key that is no problem’s unknown, a role its driver does not take, and any input left without a value.
- Return type:
- run(model: NestingGraph | ProvedGraph | Model, values: Mapping[type, Mapping[Any, Any]] = OrderedMap(), read_from: Mapping[type, Any] = OrderedMap())[source]¶
model run, valued as valued says: every place’s value, read by name.
- Return type: