model
A collection of classes for interfacing with simulation 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: str)
Abstract base class for models.
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()
Return a dict representation of the model.
- cleanup()
Perform any cleanup after all experiments have completed.
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: Sample) bool
Check if model has been initialized.
- Parameters:
policy (a Sample instance)
- property outcomes_output: dict
Getter for outcomes output.
- property output_variables: list[str]
Getter for output variables.
- reset_model()
Reset the model.
The default implementation only sets the outputs to an empty dict.
- class ema_workbench.em_framework.model.FileModel(name, wd: str | None = None, model_file: str | None = None)
Base class for a model that uses underlying files.
- as_dict() dict
Return a dict representation of the model.
- property working_directory: str
Getter for working directory.
- class ema_workbench.em_framework.model.Model(name: str, function: Callable | None = None)
Default model class for python callables that are run once per experiment.
- class ema_workbench.em_framework.model.Replicator(name: str)
Base class for a model where experiments are run for multiple replications.
- property replications
Getter for replications.
- class ema_workbench.em_framework.model.ReplicatorModel(name: str, function: Callable | None = None)
Default model class for python callables that are run for multiple replications per experiment.
- class ema_workbench.em_framework.model.SingleReplication(name: str)
Base class for models that require only a single replication.