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

[WIP] Enable using Xopt generators in optimas #151

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

RemiLehe
Copy link
Collaborator

@RemiLehe RemiLehe commented Dec 5, 2023

Attempt to use Xopt generators directly.

The tests currently fail with:

  File "/Users/rlehe/Documents/codes/optimas/optimas/generators/base.py", line 237, in tell
    self._tell(trials)
  File "/Users/rlehe/Documents/codes/optimas/optimas/generators/xopt/nelder_mead.py", line 56, in _tell
    self.xopt_gen.add_data(df)
  File "/Users/rlehe/miniconda3/envs/optimas/lib/python3.12/site-packages/xopt/generators/scipy/neldermead.py", line 137, in add_data
    assert self.future_state is not None

TODO:

  • Generalize for any Xopt optimizer
  • Check whether the Xopt optimizer can be parallel (if the number of sim workers is > 1)
  • Handle the case where Xopt is not installed (similar to Ax)

@AngelFP AngelFP added the enhancement New feature or request label Dec 12, 2023
@RemiLehe
Copy link
Collaborator Author

When using only 1 worker (instead of 2), the test run, but eventually gives:

[INFO 02-16 07:48:13] optimas.generators.base: Generated trial 79 with parameters {'x0': 0.1001368227796458, 'x1': 2.940237902665191}
[INFO 02-16 07:48:13] optimas.generators.base: Completed trial 79 with objective(s) {'f': (19.68546661624322, None)}
[0]  2024-02-16 07:48:13,945 libensemble.manager (ERROR): Traceback (most recent call last):
  File "/Users/rlehe/miniconda3/envs/optimas/lib/python3.12/site-packages/libensemble/manager.py", line 644, in run
    assert self.term_test() or any(
AssertionError: alloc_f did not return any work, although all workers are idle.

@RemiLehe
Copy link
Collaborator Author

RemiLehe commented Feb 16, 2024

I looked more closely at the error with 2 workers, here is the log:

[INFO 02-16 07:54:38] optimas.generators.base: Generated trial 0 with parameters {'x0': -1.0, 'x1': 3.5}
[INFO 02-16 07:54:38] optimas.generators.base: Generated trial 1 with parameters {'x0': -1.0, 'x1': 3.5}
[INFO 02-16 07:54:39] optimas.generators.base: Completed trial 0 with objective(s) {'f': (5.205621232603963, None)}

and then

  File "/Users/rlehe/Documents/codes/optimas/optimas/gen_functions.py", line 108, in persistent_generator
    generator.tell([trial])
  File "/Users/rlehe/Documents/codes/optimas/optimas/generators/base.py", line 237, in tell
    self._tell(trials)
  File "/Users/rlehe/Documents/codes/optimas/optimas/generators/xopt/nelder_mead.py", line 59, in _tell
    self.xopt_gen.add_data(df)
  File "/Users/rlehe/miniconda3/envs/optimas/lib/python3.12/site-packages/xopt/generators/scipy/neldermead.py", line 137, in add_data
    assert self.future_state is not None
AssertionError

so it looks like the error is not when calling generate several times (this simply returned the same point), but rather when calling add_data several times (without calling generate in-between`).

@RemiLehe
Copy link
Collaborator Author

RemiLehe commented Aug 1, 2024

This is superseded by #228

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