Return useful error when sampling multiple policies with no levers defined, or multiple scenarios with no uncertainties defined
Closed this issue · 0 comments
EwoutH commented
The code below will now give an error
raise EMAError(ema_workbench.util.ema_exceptions.EMAError: some fatal error has occurred while running the experiments, not all runs have completed. expected 100, got 0
when the code below is ran.
model = Model("simpleModel", function=some_model) # instantiate the model
# specify uncertainties
model.uncertainties = [
RealParameter("x1", 0.1, 10),
RealParameter("x2", -0.01, 0.01),
RealParameter("x3", -0.01, 0.01),
]
# specify outcomes
model.outcomes = [ScalarOutcome("y")]
with SequentialEvaluator(model) as evaluator:
results = evaluator.perform_experiments(scenarios=100, policies=1)
This error comes from the definition of policies=1
while no levers are defined. For clarity, this error message should be refined to return a useful error when sampling one or multiple policies with no levers defined, or one or multiple scenarios with no uncertainties defined.