@@ -46,12 +46,32 @@ class ModelManager:
4646 """
4747
4848 def __init__ (self , logger : Logger ):
49+ """
50+ Constructor for the ModelManager.
51+
52+ Parameters
53+ ----------
54+ logger: Logger
55+ Logger to be used by the ModelManager and the created micro simulation classes.
56+ """
4957 self ._registered_classes : list [MicroSimulationClass ] = []
5058 self ._stateless_map : dict [MicroSimulationClass , bool ] = dict ()
5159 self ._backend_map : dict [MicroSimulationClass , MicroSimulationInterface ] = dict ()
5260 self ._logger : Logger = logger
5361
5462 def load_models (self , config : Config , n_workers : int , conn_workers : Optional [Any ]):
63+ """
64+ Loads the micro simulation classes specified in the config.
65+
66+ Parameters
67+ ----------
68+ config: Config
69+ Config object.
70+ n_workers: int
71+ Number of workers to be used for the micro simulations, used for initialization of the micro simulation classes.
72+ conn_workers: Optional[Any]
73+ Connection to workers, used for initialization of the micro simulation classes.
74+ """
5575 stateless_flags = config .micro_stateless_flags ()
5676 for idx , model_file in enumerate (config .micro_file_names ()):
5777 try :
@@ -74,6 +94,7 @@ def load_models(self, config: Config, n_workers: int, conn_workers: Optional[Any
7494 def register (self , micro_sim_cls : MicroSimulationClass , stateless : bool ):
7595 """
7696 Register a micro simulation class to create an instance of it later.
97+ If a model is stateless, it will be initialized once and stored in the backend map, so that all instances of this model will delegate to the same compute instance.
7798
7899 Parameters
79100 ----------
@@ -95,6 +116,14 @@ def register(self, micro_sim_cls: MicroSimulationClass, stateless: bool):
95116
96117 @property
97118 def num_models (self ) -> int :
119+ """
120+ Returns the number of registered micro simulation classes.
121+
122+ Returns
123+ -------
124+ num_models: int
125+ Number of registered micro simulation classes.
126+ """
98127 return len (self ._registered_classes )
99128
100129 def get_cls_by_name (self , name : str ) -> MicroSimulationClass :
0 commit comments