Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow resuming an exploration and running in substeps #118

Merged
merged 11 commits into from
Oct 9, 2023

Conversation

AngelFP
Copy link
Member

@AngelFP AngelFP commented Sep 26, 2023

This PR enables two new workflows addressing #107:

  1. Running an exploration in substeps:
# Create exploration.
exploration = Exploration(
    generator=gen,
    evaluator=ev,
    max_evals=30,
    sim_workers=2
)

# Run exploration in several steps until reaching 30 evaluations.
exploration.run(n_evals=3)
exploration.run(n_evals=4)
exploration.run(n_evals=10)
exploration.run(n_evals=5)
exploration.run()  # Run remaining evaluations.

This can be useful when running optimas interactively. It would allow the user, for example, to tune the hyperparameters of the generator between each run.

  1. Resuming from a previous exploration that was executed in the same exploration_dir_path.
# Create exploration.
exploration = Exploration(
    generator=gen,
    evaluator=ev,
    max_evals=40,
    sim_workers=2,
    resume=True
)

# Run exploration until the total number of evaluations
# (including those of the previous run) reaches 40.
exploration.run()

This allows us to seamlessly continue a previous exploration

This features are enabled by the new 'reuse_output_dir' and 'final_gen_send' options in libensemble v1.0.0.

Changes

  • Added new n_evals argument to Exploration.run.
  • Added new resume option to Exploration.
  • The Exploration now keeps track of the number of evaluations.
  • The history file that is saved after run finishes is now called exploration_history_after_evaluation_{}.npy.
  • Added n_trials property to Generator to easily count how many trials it has generated.
  • The final batch of evaluations is now also given back to the Generator. Previously the generator was not informed about them. As a consequence, the last generated trials in the Ax generators remained as not completed, even though they did run.
  • A bug has been fixed in the gen_function where more trials than needed would be generated in the final batch. The gen_function is now aware of the maximum number of trials that should be generated.
  • The Exploration._reset_libensemble method has been removed. It seems that this workaround (introduced in Updating for new libE interface #88) is no longer needed in libensemble v1.0.0.
  • Update requirements to libensemble v1.0.0.
  • Added new tests for both workflows.

@AngelFP AngelFP added the enhancement New feature or request label Sep 27, 2023
@AngelFP AngelFP merged commit 24d559e into main Oct 9, 2023
9 checks passed
@AngelFP AngelFP deleted the restart_exploration branch October 9, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants