Skip to content

Commit

Permalink
Enable returning incomplete simulation results (#213)
Browse files Browse the repository at this point in the history
Fixes #212 by returning incomplete simulation results with a warning
instead of terminating the simulation when encountering an exception.
  • Loading branch information
AdrianSosic authored May 13, 2024
2 parents 7835d38 + 60a9662 commit fad3324
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- User guide now explains the new objective classes
- Telemetry deactivation warning is only shown to developers
- `torch`, `gpytorch` and `botorch` are lazy-loaded for improved startup time
- If an exception is encountered during simulation, incomplete results are returned
with a warning instead of passing through the uncaught exception

### Removed
- `model_params` attribute from `Surrogate` base class, `GaussianProcessSurrogate` and
Expand Down
9 changes: 9 additions & 0 deletions baybe/simulation/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ def simulate_experiment(
)
break

# Temporary workaround to enable returning incomplete simulations
except Exception as ex:
warnings.warn(
f"An error has occurred during the simulation, "
f"therefore incomplete simulation results are returned. "
f"The error message was:\n{str(ex)}"
)
break

n_experiments += len(measured)
_look_up_target_values(measured, campaign, lookup, impute_mode)

Expand Down

0 comments on commit fad3324

Please sign in to comment.