optimas-org / optimas

Optimization at scale, powered by libEnsemble
https://optimas.readthedocs.io
Other
22 stars 13 forks source link

Loading history file from `ExplorationDiagnostics` fails sometimes #225

Closed delaossa closed 1 month ago

delaossa commented 2 months ago

Sometimes, when optimas is still running, opening the current history file from ExplorationDiagnostics fails.

I have tracked the error to this line: https://github.com/optimas-org/optimas/blob/9490ea379fcc2b0457177937f3c6de03402a813b/optimas/generators/base.py#L296

The problem occurs when one of the trial.index is not present in history["trial_index"]. In practical cases, I have observed this happening only for the last item in history["trial_index"], differing from the last item in [trial.index for trial in trials].

The problem resolves automatically when the optimas run is finished or another history checkpoint is reached without this issue.

delaossa commented 1 month ago

PR https://github.com/optimas-org/optimas/pull/230 makes ExplorationDiagnostics not to crash when it is initialized from history file.