ema workbench

Other Sub Sites


Created on 23 dec. 2010

Code author: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>

class model.ModelStructureInterface(workingDirectory, name)

ModelStructureInterface is one of the the two main classes used for performing EMA. This class should be extended to provide an interface to the actual model.


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.


Method for retrieving model structure uncertainties.

Returns:list of the uncertainties of the model interface.
model_init(policy, kwargs)

Method called to initialize the model.

  • policy – policy to be run.
  • kwargs – keyword arguments to be used by model_intit. This gives users to the ability to pass any additional arguments.


This method should always be implemented. Although in simple cases, a simple pass can suffice.

name = None

name of the model interface

outcomes = []

list of outcome instances

output = {}

results, this should be a dict with the names of the outcomes as key


Method for reseting the model to its initial state. The default implementation only sets the outputs to an empty dict.


Method for retrieving output after a model run.

Returns:the results of a model run.

Method for running an instantiated model structure.

This method should always be implemented.

Parameters:case – keyword arguments for running the model. The case is a dict with the names of the uncertainties as key, and the values to which to set these uncertainties.


This method should always be implemented.


Method for setting the working directory of the model interface. This method is used in case of running models in parallel. In this case, each worker process will have its own working directory, to avoid having to share files across processes. This requires the need to update the working directory to the new working directory.

Parameters:wd – The new working directory.
uncertainties = []

list of uncertainty instances