cottax.relational.consumers.declaration.vocabulary module¶
The relational declaring part of a Surface: RelationalDeclaring, the implicit models, the constraints and the condition nodes; and the readings of its arguments (within_of and against_of for the constraints, bounds_of, design_of, targets_of), written over the declaring part’s term and per_place.
- type SubjectTo = Constraint | RelationalCondition | Iterable[Constraint | RelationalCondition]¶
- within_of[V](surface: Declaring, fn: Any, outputs: tuple[V, ...], within: Within)[source]¶
A constraint’s within=: each output’s (lo, hi), at most zero where none is given.
- Return type:
Bounds[V]
- against_of[V](surface: Declaring, fn: Any, outputs: tuple[V, ...], against: Against)[source]¶
An equality constraint’s against=: each output’s target, zero where none is given.
- Return type:
OrderedMap[V,Optional[PlaceWithValue[V]]]
- class RelationalDeclaring(locator: Locator[V, N], conventions: ~cottax.consumers.declaration.conventions.Conventions = Conventions(reads=ParameterReads(by_name=True), term=<function term_of>, per_place=<function per_place_of>))[source]¶
Bases:
DeclaringThe relational declarations: implicit models and constraints as functions, and the relational conditions over them.
- residual¶
A function returning a residual per unknown, and the problem where each vanishes: residual(fn, *unknowns), or @residual(*unknowns).
- fixed_point¶
A function returning each unknown’s next value, and the problem holding each equal to it: fixed_point(fn, *unknowns), or @fixed_point(*unknowns).
- inequality_constraint¶
A function computing its outputs, each within its (lo, hi) – one pair for the one output there is, or a mapping of pairs – and with none given at most zero: inequality_constraint(fn, *outputs, within=(None, ‘g_max’)), or the decorator.
- equality_constraint¶
A function computing its outputs, each equal to its target – one for the one output there is, or a mapping – and with none given zero: equality_constraint(fn, *outputs, against=’h_target’), or the decorator.
- requirement(condition: Place, op: type[Rel] = Eq)[source]¶
c op 0, determining nothing: held by a problem subject to it, or where an architecture puts it.
- Return type:
- satisfy(*, design: Design, subject_to: SubjectTo = ())[source]¶
Any point of design (names, or a mapping to (lo, hi)) meeting the constraints it is subject to (one, or a collection), nothing minimised: a root find where those are equalities.
- Return type:
- optimise(*, design: Design, minimise: Place | None = None, maximise: Place | None = None, subject_to: SubjectTo = ())[source]¶
Minimise or maximise one objective over design (names, or a mapping to (lo, hi)), subject to constraints – one, or a collection: constraint wrappers in the model, or bare requirements, held by the problem.
- Return type:
- bounds_of[V](surface: Declaring, among: tuple[V, ...], within: Within)[source]¶
The (lo, hi) written on among, one pair for the one place there is or a mapping of pairs: each side a term, minted at ^lower or ^upper where a value, or None for no bound. Anything but a pair is refused.
- Return type:
Bounds[V]
- design_of[V](surface: Declaring, design: Design)[source]¶
A problem’s unknowns, in order, and their bounds: names, or a mapping of each to its (lo, hi). What stands for places (its Written answer) is all of them, a key one alone.
- Return type:
tuple[tuple[V,...],Bounds[V]]
- targets_of[V](surface: Declaring, outputs: tuple[V, ...], against: Against)[source]¶
An equality’s target per output, one for the one output there is or a mapping, and with none given zero; each a term, minted at ^target where a value.
- Return type:
OrderedMap[V,Optional[PlaceWithValue[V]]]