model
This module specifies the abstract base class for interfacing with models. Any model that is to be controlled from the workbench is controlled via an instance of an extension of this abstract base class.
- class ema_workbench.em_framework.model.AbstractModel(name)
ModelStructureInterface
is one of the the two main classes used for performing EMA. This is an abstract base class and cannot be used directly.- uncertainties
list of parameter instances
- Type:
list
- levers
list of parameter instances
- Type:
list
- outcomes
list of outcome instances
- Type:
list
- name
alphanumerical name of model structure interface
- Type:
str
- output
this should be a dict with the names of the outcomes as key
- Type:
dict
- When extending this class :meth:`model_init` and
- :meth:`run_model` have to be implemented.
- as_dict()
returns a dict representation of the model
- cleanup()
This model is called after finishing all the experiments, but just prior to returning the results. This method gives a hook for doing any cleanup, such as closing applications.
In case of running in parallel, this method is called during the cleanup of the pool, just prior to removing the temporary directories.
- initialized(policy)
check if model has been initialized
- Parameters:
policy (a Policy instance)
- model_init(policy)
Method called to initialize the model.
- Parameters:
policy (dict) – policy to be run.
Note
This method should always be implemented. Although in simple cases, a simple pass can suffice.
- reset_model()
Method for resetting the model to its initial state. The default implementation only sets the outputs to an empty dict.
- retrieve_output()
Method for retrieving output after a model run. Deprecated, will be removed in version 3.0 of the EMAworkbench.
- Return type:
dict with the results of a model run.
- run_model(scenario, policy)
Method for running an instantiated model structure.
- Parameters:
scenario (Scenario instance)
policy (Policy instance)
- class ema_workbench.em_framework.model.FileModel(name, wd=None, model_file=None)
- as_dict()
returns a dict representation of the model
- class ema_workbench.em_framework.model.Model(name, function=None)
- class ema_workbench.em_framework.model.Replicator(name)
- run_model(scenario, policy)
Method for running an instantiated model structure.
- Parameters:
scenario (Scenario instance)
policy (Policy instance)
- class ema_workbench.em_framework.model.ReplicatorModel(name, function=None)