optimas-org / optimas

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

Avoid overwriting history file on resume #222

Open AngelFP opened 2 months ago

AngelFP commented 2 months ago

When resuming an Exploration, the history file will be read and then modified to incorporate new evaluations from the resumed run. However, this behavior can have unwanted consequences if the resumed run has any issue and is cancelled, for example. The user would then want to resume again from the first run, but the history would already contain data from the previous failed resume.

See this comment, for example:

I could resume the optimization with changes in the parameters range with no problem. However, I realized that I wanted to use fit_out_of_design=True (instead of the default, which is False). So I canceled the run and started over. This time the history file was different and contained the cancelled simulations from the previous resume attempt. I had to remove manually these entries from the history file, rename it and revert the changes in the parameters ranges in exploration_parameters.json to start over adequately.

I wonder if it would be a good idea to backup automatically the history file from which the exploration run is resuming. Previous versions had a feature like this if I recall well.

Originally posted by @delaossa in https://github.com/optimas-org/optimas/issues/185#issuecomment-2152652570

We should therefore investigate the option of not overwriting the history file on resume, either by keeping a copy of the original one or by using a different name for the history with resume.