Overview
This is a big one.
At the core of this release stands **linearization** which required some major refactors of the ode solver interface (through `Solver` and its subclasses) and internal structure of the blocks. The newly introduced callable `Operator` and `DynamicOperator` classes wrap functions and enable automatic linearization in an operating point. This reduces block- and system-level linearization to the linearization of the internal operators of the blocks which is now handled by the operators themself.
What this enables is the linearization (and delinearization) of individual blocks, subsystems or the full system at runtime. This can even be triggered through events.
Operators
- Introduced new `pathsim.optim.operator` module that defines the `Operator` and `DynamicOperator` classes
- Can wrap callables / functions and have built in methods for linearization in an operating point, using a first order taylor approximation
- Automatic jacobian evaluation (`op.jac(x)` or `op.jac_x(x, u, t)`, `op.jac_u(x, u, t)`) through either user specified jacobians, automatic differentiation or numerical differentiation (in this order)
- When linearized, subsequent calls with `op()` use the internal taylor approximation (linear surrogate model)
Refactoring
- `Solver` now doesnt take func and jac as callables anymore, `step` and `solve` methods now take the value of the evaluated function and the value of the evaluated Jacobian, shifting the responsibility of the function and jacobian evaluation away from the ODE solvers and towards the blocks
- Adjusted core simulation loop to reflect this shift in responsibility
- `Block` now has attributes `op_dyn` and `op_alg` which are either `None` or instances of the `Operator` or `DynamicOperator` classes, they define the behaviour of algebraic and dynamic blocks and ultimately enable runtime linearization
Linearization
- Added `linearize` and `delinearize` methods to `Simulation`, `Subsystem` and `Block` to automaticalls linearize and delinearize these components
Serialization
- Streamlined serialization, zerializable objects have the option to add metadata
AD
- Improved `Value` class performance by 10% for arithmetic operations by using `defaultdict(float)` for sparse gradient tracking