smif.model.model_set module¶
Wrap and solve a set of interdependent models
Given a directed graph of dependencies between models, any cyclic dependencies are contained within the strongly-connected components of the graph.
A ModelSet corresponds to the set of models within a single strongly- connected component. This class provides the machinery necessary to find a solution to each of the interdependent models.
The current implementation first estimates the outputs for each model in the set, guaranteeing that each model will then be able to run, then begins iterating, running every model in the set at each iteration, monitoring the model outputs over the iterations, and stopping at timeout, divergence or convergence.
Reference¶
-
class
smif.model.model_set.
ModelSet
(models, max_iterations=25, relative_tolerance=1e-05, absolute_tolerance=1e-08)[source]¶ Bases:
smif.model.CompositeModel
Wraps a set of interdependent models
Parameters: - models (dict) – A dict of model_name str => model
smif.model.Model
- max_iterations (int, default=25) – The maximum number of iterations that the model set will run before returning results
- relative_tolerance (float, default=1e-05) – Used to calculate when the model interations have converged
- absolute_tolerance (float, default=1e-08) – Used to calculate when the model interations have converged
-
max_iterations
¶ int – The maximum number of iterations
-
models
¶ list – The list of
smif.model.Model
subclasses
-
max_iteration
¶ The maximum iteration reached before convergence
- models (dict) – A dict of model_name str => model