cottax.relational¶
The language a condition node is written in: relations, objectives, and rewrites over them.
Dependency:
- relational_condition (Rel / Eq / Le, Relation, Sense / Min / Max, Objective,
|| RelationalCondition, its +) ||—————————- / / /
- rewrites programme classification (rewrites: FixedPointCut, cuts closed by a
|| problem on their copies; / programme: Programme, a condition read as a
- contracts nonlinear programme, places only;
classification: the shapes, as predicates; contracts: the shipped driver contracts and their defaults, CONTRACTS)
Imported by name, not here: contracts, and what the language tells each consumer (consumers/), its closing among them (consumers/architectures).
- class Rel[source]¶
Bases:
objectMarker for a relation, asked by identity: a relation holds the class itself. A new one subclasses Rel with a symbol.
- symbol: str¶
How a relation writes it.
- class Relation[V: Place](lhs: Optional[V], rhs: Optional[V], op: type[Rel])[source]¶
Bases:
Frozen,Generic[V]lhs op rhs between two places; a side of None is zero.
- lhs: Optional[V]¶
- rhs: Optional[V]¶
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_sides>, <function check_op>)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- property terms: tuple[V, ...]¶
The sides that are places, left then right.
- class RelationalCondition[V: Place](relations: tuple[Relation[V], ...], objectives: tuple[Objective[V], ...], unknowns: tuple[V, ...], parameters: tuple[V, ...])[source]¶
Bases:
ConditionalNode[V],Generic[V]A condition node: relations and objectives over places, the unknowns it determines and the parameters it holds fixed. Every other term is a condition. Supports addition.
- unknowns: tuple[V, ...]¶
What this node determines; () for a requirement.
- parameters: tuple[V, ...]¶
a bound, a limit. Read, not a condition, so a proof asks them off the problem’s cycle.
- Type:
Terms read and held fixed while the unknowns move
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_relates_something>, <function check_parameters>)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- property conditions: tuple[V, ...]¶
The objectives, then every relation’s terms that are neither unknowns nor parameters, in order.
- property reads: tuple[V, ...]¶
The conditions, then the parameters.
- property owns: tuple[V, ...]¶
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
- determined(unknowns: tuple[V, ...])[source]¶
Same ConditionalNode but determined by the unknowns.
- Return type:
- class Sense[source]¶
Bases:
objectMarker for which way an objective is driven, asked by identity: an objective holds the class itself.
- symbol: str¶
How an objective writes it.
- class Objective[V: Place](place: V, sense: type[Sense])[source]¶
Bases:
Frozen,Generic[V]A place and the way it is driven: which way changes the answer, so it is the problem’s, stored with the place it drives.
- place: V¶
- is_constrained_optimise(node: object)[source]¶
An optimise with relations to respect as well.
- Return type:
bool
- is_equalities(node: object)[source]¶
No objective, every relation an equality. is_fixed_point / is_root_find.
- Return type:
bool
- is_feasibility(node: object)[source]¶
No objective and an inequality among the relations: any point satisfying them will do.
- Return type:
bool
- is_fixed_point(node: object)[source]¶
Equalities of which every one is u = g (fixed_point_shaped).
- Return type:
bool
- is_optimise(node: object)[source]¶
Exactly one objective. is_unconstrained_optimise / is_constrained_optimise.
- Return type:
bool
- is_root_find(node: object)[source]¶
Every other system of equalities: a(x) = b(x), which is c(x) = 0 WLOG.
- Return type:
bool
- is_unconstrained_optimise(node: object)[source]¶
An optimise with no relation beside the objective.
- Return type:
bool
- class FixedPointCut[N: Label, V: Place](cuts: tuple[Cut[N, V], ...], at: N)[source]¶
Bases:
ComposedOp[N,V],Generic[N,V]Several cuts and the problem that determines every copy they mint: ^copy.x = x per cut, so the condition is the next iterate and the loop is re-closed through it.
- at: N¶
Where the problem closing the cuts is bound – a binding of its own.
- checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_cuts>,)¶
Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).
- property vars: tuple[V, ...]¶
What was cut, in the order the cuts were given.
- property copies: tuple[V, ...]¶
The copies the readers end up reading, one per cut.
- property definition: RelationalCondition[V]¶
One relation per cut, paired by the order the cuts were given.
- class Programme[V: Place](objectives: tuple[Objective[V], ...], equalities: tuple[Relation[V], ...], inequalities: tuple[Relation[V], ...], lower: OrderedMap[V, tuple[Optional[V], ...]], upper: OrderedMap[V, tuple[Optional[V], ...]])[source]¶
Bases:
Frozen,Generic[V]A condition as min objectives subject to equalities, inequalities and a box: places only.
- lower: OrderedMap[V, tuple[Optional[V], ...]]¶
Per unknown, in unknowns order, the sides bounding it from below as met; None is zero.
- upper: OrderedMap[V, tuple[Optional[V], ...]]¶
Per unknown, the sides bounding it from above, likewise.
- programme[V: Place](condition: RelationalCondition[V])[source]¶
Each relation in its group, in condition.relations order; a bound to its unknown’s side of the box.
- Return type:
Programme[V]