pywr.recorders.Recorder
- class pywr.recorders.Recorder(model, agg_func='mean', ignore_nan=False, is_objective=None, epsilon=1.0, name=None, constraint_lower_bounds=None, constraint_upper_bounds=None, **kwargs)
Base class for recording information from a pywr.model.Model.
Recorder components are used to calculate, aggregate and save data from a simulation. This base class provides the basic functionality for all recorders.
- Parameters:
- modelpywr.core.Model
- agg_funcstr or callable (default=”mean”)
Scenario aggregation function to use when aggregated_value is called.
- namestr (default=None)
Name of the recorder.
- commentstr (default=None)
Comment or description of the recorder.
- ignore_nanbool (default=False)
Flag to ignore NaN values when calling aggregated_value.
- is_objective{None, ‘maximize’, ‘maximise’, ‘max’, ‘minimize’, ‘minimise’, ‘min’}
Flag to denote the direction, if any, of optimisation undertaken with this recorder.
- epsilonfloat (default=1.0)
Epsilon distance used by some optimisation algorithms.
- constraint_lower_bounds, constraint_upper_boundsdouble (default=None)
The value(s) to use for lower and upper bound definitions. These values determine whether the recorder instance is marked as a constraint. Either bound can be None (the default) to disable the respective bound. If both bounds are None then the is_constraint property will return False. The lower bound must be strictly less than the upper bound. An equality constraint can be created by setting both bounds to the same value.
The constraint bounds are not used during model simulation. Instead they are intended for use by optimisation wrappers (or other external tools) to define constrained optimisation problems.
- __init__(*args, **kwargs)
Methods
__init__
(*args, **kwargs)after
(self)aggregated_value
(self)before
(self)finish
(self)is_constraint_violated
(self)Returns true if the value from this Recorder violates its constraint bounds.
load
(cls, model, data)register
(cls)reset
(self)setup
(self)unregister
(cls)values
(self)Attributes
agg_func
children
comment
comment: unicode
constraint_lower_bounds
constraint_upper_bounds
epsilon
epsilon: 'double'
ignore_nan
ignore_nan: 'bool'
is_constraint
Returns true if either upper or lower constraint bounds is defined.
is_double_bounded_constraint
Returns true if upper and lower constraint bounds are both defined and not-equal to one another.
is_equality_constraint
Returns true if upper and lower constraint bounds are both defined and equal to one another.
is_lower_bounded_constraint
Returns true if lower constraint bounds is defined and upper constraint bounds is not.
is_objective
is_upper_bounded_constraint
Returns true if upper constraint bounds is defined and lower constraint bounds is not.
model
name
parents
tags
tags: dict