ade.constraints.Constraints(object)
class documentation
Part of ade.constraints
(View In Hierarchy)
Subclass me and define one or more constraint-checking methods.
Register the methods to be used with a given instance of that subclass
by defining a registry dict in your subclass, keyed by method name.
Each entry must have a 2-sequence, with the first item being linear
parameter names (or None
) and log-space parameter names (or
None
) for the constraint method.
You can define instance attributes via constructor keywords. Any
constructor arguments are supplied to the setup
method
you can override in your subclass, which gets called during construction
right after instance attributes get set by any constructor keywords.
To just add a raw constraint function that gets called without any
parameter transformations, use append
.
Log-space parameter values are used in the author's ongoing circuit simulation project and are supported in this module, but not yet implemented at the level of the ade package otherwise.
Class Variable | debug | Set True to have failing constraints shown with parameters.
(Debugging only.) |
Method | __init__ | Undocumented |
Method | setup | Override this to do setup with any constructor arguments and with instance attributes set via any constructor keywords. |
Method | __len__ | Undocumented |
Method | __bool__ | Undocumented |
Method | __iter__ | Iterating over an instance of me yields wrappers of my class-wide constraint-checking functions registered in my cList, plus any functions registered after setup in my fList. |
Method | append | Undocumented |
Override this to do setup with any constructor arguments and with instance attributes set via any constructor keywords.
Iterating over an instance of me yields wrappers of my class-wide constraint-checking functions registered in my cList, plus any functions registered after setup in my fList.
You can register a function in fList after setup by calling append
with
the callable as the sole argument. It will be treated exactly the same
except called after class-wide functions.
Each wrapper automatically transforms any log parameters into their
linear values before calling the wrapped constraint-checking function with
a revised parameter dict. Also, if a parameter is not present, forces a
True
"constraint satisfied" result so that setting a
parameter to known doesn't cause bogus constraint checking.
You can treat an instance of me sort of like a list, using iteration and appending. But you can't get or set individual items by index.