outcomes

Module for outcome classes

class ema_workbench.em_framework.outcomes.AbstractOutcome(name, kind=0, variable_name=None, function=None, expected_range=None, shape=None, dtype=None)

Base Outcome class

Parameters:
  • name (str) – Name of the outcome.

  • kind ({INFO, MINIMIZE, MAXIMIZE}, optional)

  • variable_name (str, optional) – if the name of the outcome in the underlying model is different from the name of the outcome, you can supply the variable name as an optional argument, if not provided, defaults to name

  • function (callable, optional) – a callable to perform postprocessing on data retrieved from model

  • expected_range (2 tuple, optional) – expected min and max value for outcome, used by HyperVolume convergence metric

  • shape ({tuple, None} optional) – must be used in conjunction with dtype. Enables pre-allocation of data structure for storing results.

  • dtype (datatype, optional) – must be used in conjunction with shape. Enables pre-allocation of data structure for storing results.

name
Type:

str

kind
Type:

int

variable_name
Type:

str

function
Type:

callable

shape
Type:

tuple

dtype
Type:

dataype

abstract classmethod from_disk(filename, archive)

helper function for loading from disk

Parameters:
  • filename (str)

  • archive (Tarfile)

abstract classmethod to_disk(values)

helper function for writing outcome to disk

Parameters:

values (obj) – data to store

Return type:

BytesIO

class ema_workbench.em_framework.outcomes.ArrayOutcome(name, variable_name=None, function=None, expected_range=None, shape=None, dtype=None)

Array Outcome class for n-dimensional arrays

Parameters:
  • name (str) – Name of the outcome.

  • variable_name (str, optional) – if the name of the outcome in the underlying model is different from the name of the outcome, you can supply the variable name as an optional argument, if not provided, defaults to name

  • function (callable, optional) – a callable to perform postprocessing on data retrieved from model

  • expected_range (2 tuple, optional) – expected min and max value for outcome, used by HyperVolume convergence metric

  • shape ({tuple, None} optional) – must be used in conjunction with dtype. Enables pre-allocation of data structure for storing results.

  • dtype (datatype, optional) – must be used in conjunction with shape. Enables pre-allocation of data structure for storing results.

name
Type:

str

kind
Type:

int

variable_name
Type:

str

function
Type:

callable

shape
Type:

tuple

expected_range
Type:

tuple

dtype
Type:

datatype

classmethod from_disk(filename, archive)

helper function for loading from disk

Parameters:
  • filename (str)

  • archive (Tarfile)

classmethod to_disk(values)

helper function for writing outcome to disk

Parameters:

values (ND array)

Returns:

  • BytesIO

  • filename

class ema_workbench.em_framework.outcomes.Constraint(name, parameter_names=None, outcome_names=None, function=None)

Constraints class that can be used when defining constrained optimization problems.

Parameters:
  • name (str)

  • parameter_names (str or collection of str)

  • outcome_names (str or collection of str)

  • function (callable)

name
Type:

str

parameter_names

name(s) of the uncertain parameter(s) and/or lever parameter(s) to which the constraint applies

Type:

str, list of str

outcome_names

name(s) of the outcome(s) to which the constraint applies

Type:

str, list of str

function

The function should return the distance from the feasibility threshold, given the model outputs with a variable name. The distance should be 0 if the constraint is met.

Type:

callable

class ema_workbench.em_framework.outcomes.ScalarOutcome(name, kind=0, variable_name=None, function=None, expected_range=None, dtype=None)

Scalar Outcome class

Parameters:
  • name (str) – Name of the outcome.

  • kind ({INFO, MINIMIZE, MAXIMIZE}, optional)

  • variable_name (str, optional) – if the name of the outcome in the underlying model is different from the name of the outcome, you can supply the variable name as an optional argument, if not provided, defaults to name

  • function (callable, optional) – a callable to perform post processing on data retrieved from model

  • expected_range (collection, optional) – expected min and max value for outcome, used by HyperVolume convergence metric

  • dtype (datatype, optional) – Enables pre-allocation of data structure for storing results.

name
Type:

str

kind
Type:

int

variable_name
Type:

str

function
Type:

callable

shape
Type:

tuple

expected_range
Type:

tuple

dtype
Type:

datatype

classmethod from_disk(filename, archive)

helper function for loading from disk

Parameters:
  • filename (str)

  • archive (Tarfile)

classmethod to_disk(values)

helper function for writing outcome to disk

Parameters:

values (1D array)

Returns:

  • BytesIO

  • filename

class ema_workbench.em_framework.outcomes.TimeSeriesOutcome(name, variable_name=None, function=None, expected_range=None, shape=None, dtype=None)

TimeSeries Outcome class for 1D arrays

Parameters:
  • name (str) – Name of the outcome.

  • variable_name (str, optional) – if the name of the outcome in the underlying model is different from the name of the outcome, you can supply the variable name as an optional argument, if not provided, defaults to name

  • function (callable, optional) – a callable to perform postprocessing on data retrieved from model

  • expected_range (2 tuple, optional) – expected min and max value for outcome, used by HyperVolume convergence metric

  • shape ({tuple, None} optional) – must be used in conjunction with dtype. Enables pre-allocation of data structure for storing results.

  • dtype (datatype, optional) – must be used in conjunction with shape. Enables pre-allocation of data structure for storing results.

name
Type:

str

kind
Type:

int

variable_name
Type:

str

function
Type:

callable

shape
Type:

tuple

expected_range
Type:

tuple

dtype
Type:

datatype

Notes

Time series outcomes are currently assumed to be 1D arrays. If you are dealing with higher dimensional outputs (e.g., multiple replications resulting in 2D arrays), use ArrayOutcome instead.

classmethod from_disk(filename, archive)

helper function for loading from disk

Parameters:
  • filename (str)

  • archive (Tarfile)

classmethod to_disk(values)

helper function for writing outcome to disk

Parameters:

values (DataFrame)

Returns:

  • StringIO

  • filename