Skip to content

Conversation

@shuds13
Copy link
Member

@shuds13 shuds13 commented Nov 19, 2025

Add tests for these Xopt generators

Generator: Baysian (Expected Improvement)
Gen: https://github.com/xopt-org/Xopt/blob/generator_standard/xopt/generators/bayesian/expected_improvement.py

Xopt tests: https://github.com/xopt-org/Xopt/blob/generator_standard/xopt/tests/generators/bayesian/test_expected_improvement.py

Generator: Sequential (neldermead)
Gen: https://github.com/xopt-org/Xopt/blob/generator_standard/xopt/generators/sequential/neldermead.py

Xopt tests: https://github.com/xopt-org/Xopt/blob/generator_standard/xopt/tests/generators/sequential/test_neldermead.py

To check

  • Xopt Expected Improvement test (with libE sim and with gest-api sim)
  • Xopt Sequential (neldermead) test - Fixed self.future_state is None error
  • Need to merge in Remove automapping #1622 into this branch - removing auto-conversions that we dont want.
  • Also adding gest_api_wrapper sim func so xopt/gest-api style sims can be used directly
  • Check for TODO notes
  • Make sure xopt dependency in CI files (test or extra tests) and run full tests
  • Add xopt generator notebook and tutorial in docs
  • Enable pass-through of executor and user_specs to gest-api sim
  • Add forces variant using xopt generator.

Deferred to #1634
- [ ] Currently fixing nworkers to batch_size. Change to run using test harness command line settings.
- [ ] Re-enable running of full tests (REG_TEST_LIST = "test_*.py") - currently only runs new tests.

Optimas generators

  • GridSamplingGenerator based on Optimas test test_grid_sampling.py

Deferred to #1634
- [ ] Ax Generators (single/multi-fidelity / multitask). - Unexpected vars from suggest (not in H array).

Set GenSpecs / SimSpecs by vocs

This highlights need for GenSpecs/SimSpecs to be settable by vocs to prevent repetition. This should also use dtypes if they are set.

e.g.

    gen_specs = GenSpecs(
        generator=gen,
        batch_size=batch_size,
        vocs=vocs,
    )

For vocs settings:

  • Add vocs option to GenSpecs
  • Add vocs option to SimSpecs
  • Make sure handles types correctly (from vocs objects - defaulting to float)
  • Check does not result in bypassing any validation (currently none to bypass)
    - [ ] For libE gens with user specs it should set lb/ub from vocs also (defer Make set_fields_from_vocs set bounds when required. #1621)
  • Make unit test for this feature.

Note that if generator.vocs storage of vocs was in the standard, we could take from the gen, and not even need to supply vocs here (better SSoT).

@shuds13 shuds13 changed the title Add Xopt EI test Add Xopt tests Nov 19, 2025
@shuds13
Copy link
Member Author

shuds13 commented Nov 19, 2025

On first run I get:


  File "/home/shudson/libensemble/libe_vocs_xopt_fixes/libensemble/utils/runners.py", line 54, in run
    return self._result(calc_in, Work["persis_info"], Work["libE_info"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shudson/libensemble/libe_vocs_xopt_fixes/libensemble/utils/runners.py", line 160, in _result
    return self._persistent_result(calc_in, persis_info, libE_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shudson/libensemble/libe_vocs_xopt_fixes/libensemble/utils/runners.py", line 149, in _persistent_result
    self._get_initial_suggest(libE_info),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shudson/libensemble/libe_vocs_xopt_fixes/libensemble/utils/runners.py", line 136, in _get_initial_suggest
    H_out = self.gen.suggest(initial_batch)
            ^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'suggest'

Looks like this is due to going via standard runner, while libE gest-api generators go via subclasses.

Fix: This was due to generator being converted to dictionary in libE (given that xopt gen is a pydantic model). I now restore the original in that case.

@shuds13 shuds13 changed the title Add Xopt tests Add Xopt and Optimas generator tests Nov 25, 2025
@jlnav jlnav marked this pull request as ready for review December 2, 2025 21:10
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 49.09091% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.95%. Comparing base (41a4cbc) to head (589d8fb).
⚠️ Report is 52 commits behind head on experimental/jlnav_plus_shuds_asktell.

Files with missing lines Patch % Lines
libensemble/sim_funcs/gest_api_wrapper.py 0.00% 30 Missing ⚠️
libensemble/specs.py 71.42% 13 Missing and 7 partials ⚠️
libensemble/generators.py 0.00% 2 Missing ⚠️
libensemble/libE.py 0.00% 1 Missing and 1 partial ⚠️
libensemble/utils/runners.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                             @@
##           experimental/jlnav_plus_shuds_asktell    #1620       +/-   ##
==========================================================================
- Coverage                                  78.73%   47.95%   -30.78%     
==========================================================================
  Files                                         79       80        +1     
  Lines                                       7993     8079       +86     
  Branches                                    1196     1222       +26     
==========================================================================
- Hits                                        6293     3874     -2419     
- Misses                                      1481     3985     +2504     
- Partials                                     219      220        +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


# Get input fields (variables + constants) and output fields (objectives + observables + constraints)
input_fields = get_vocs_fields(vocs, ["variables", "constants"])
output_fields = get_vocs_fields(vocs, ["objectives", "observables", "constraints"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VOCS has a VOCS.output_names property that may be usable here. Perhaps VOCS could use an .input_names property too.

@shuds13 shuds13 merged commit 7288d08 into experimental/jlnav_plus_shuds_asktell Dec 9, 2025
12 checks passed
@shuds13 shuds13 deleted the examples/xopt_generators branch December 9, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants