-
Notifications
You must be signed in to change notification settings - Fork 94
ScalarOutcome and ArrayOutcome not compatible with ReplicatorModel #94
Description
ScalarOutcome
When running a model with replications and at least one scalar outcome, the following error is returned by ScalarOutcome.process():
EMAError: outcome s should be a scalar, but is <class 'list'>: [...]
This seems to happen because ScalarOutcome.process() checks whether what is returned from the model is actually a scalar as expected, but the Replicator has already put the individual replications into a list. A possible fix would be to first check whether the returned object is a list, and if so, check whether the first list entry is a scalar.
ArrayOutcome
Similarly, when running a ReplicatorModel with a 2-dimensional ArrayOutcome, the following error is returned:
EMAError: can only save up to 2d arrays, this array is 3d
This one comes from DefaultCallback._store_outcomes(). The shape is "replications * dim1 * dim2". I'm not sure why 3d arrays aren't allowed, since running a model with replications and time series outputs also creates a 3d array (experiments * replications * time steps).
I feel these errors are conceptually related, since in both cases the returned object is checked after the replications have already been turned into a list. Might be possible to run the checks before the list of replications is made? I attached an example file that can generate both errors.