scalarization.Scalarizer
Module Contents
Classes
Implements a class for scalarizing vector valued functions with a |
|
Implements a class to scalarize discrete vectors given a scalarizing function. |
Attributes
- class scalarization.Scalarizer.Scalarizer(evaluator: Callable, scalarizer: Callable, evaluator_args: Dict = None, scalarizer_args: Dict = None)[source]
Implements a class for scalarizing vector valued functions with a given scalarization function.
- Parameters:
evaluator (Callable) – A Callable object returning a numpy array.
scalarizer (Callable) – A function which should accepts as its arguments the output of evaluator and return a single value.
evaluator_args (Any, optional) – Optional arguments to be passed to evaluator. Defaults to None.
scalarizer_args (Any, optional) – Optional arguments to be passed to scalarizer. Defaults to None.
- evaluate(xs: numpy.ndarray) numpy.ndarray [source]
Evaluates the scalarized function with the given arguments and returns a scalar value for each vector of variables given in a numpy array.
- Parameters:
xs (np.ndarray) – A 2D numpy array containing vectors of variables on each of its rows.
- Returns:
- A 1D numpy array with the values returned by the
scalarizer for each row in xs.
- Return type:
np.ndarray