Simulation Templates (ABCs)

Abstract base class (ABC) for simulation function outputs.

Defines an ABC for the callable sim_func class.

class simulations.sim_func.sim_func(des)

Abstract base class (ABC) for simulation function outputs.

Contains 2 methods:
  • __init__(des, sim)

  • __call__(x)

The __init__ method is already implemented, and is the constructor.

The __call__ method is left to be implemented, and performs the simulation evaluation.

__init__(des)

Constructor for simulation functions.

Parameters:

des (numpy.dtype or int) – Either the numpy.dtype of the design variables or the number of design variables, assumed to all be continuous and unnamed.

abstract __call__(x)

Make sim_func objects callable.

Parameters:

x (numpy.array) – A numpy.ndarray (unnamed) or numpy structured array (named), containing the design point to evaluate.

Returns:

The output of this simulation for the input x.

Return type:

numpy.ndarray