cottax.core.driven.driver module¶
What a driver is: what it accepts, and the roles its places play.
- class Role[source]¶
Bases:
ABCWhat a place is to a driver: a class, never a value. Free to extend.
- abstractmethod classmethod arity(node: ConditionalNode)[source]¶
How many places the role takes on node.
- Return type:
int
- class PerUnknown[source]¶
Bases:
RoleRole per unknown (e.g. initial guesses)
- classmethod arity(node: ConditionalNode)[source]¶
How many places the role takes on node.
- Return type:
int
- class PerProblem[source]¶
Bases:
RoleRole about solve (e.g. global tolerance)
- classmethod arity(node: ConditionalNode)[source]¶
How many places the role takes on node.
- Return type:
int
- class DriverContract[V: Place][source]¶
Bases:
Frozen,Generic[V]Algorithm answering a ConditionalNode’s problem.
takes (input roles) is not exhaustive: certain choices can not be made from the graph such as a Linear Solver type for a Newton driver.
- accepts: AbstractVar[Callable[[ConditionalNode[V]], bool]]¶
Whether it accepts that ConditionalNode
- takes: AbstractVar[tuple[type[Role], ...]]¶
Input roles
- reports: AbstractVar[tuple[type[Role], ...]]¶
Output roles.
- entry_for[T, D](table: Mapping[type[DriverContract], T], contract: DriverContract, default: D = None)[source]¶
The entry of table for contract’s most specific class along its ancestry, whatever order the table is written in; default if none covers it.
- Return type:
Union[T,D]