Skip to content

Commit 699d7ca

Browse files
authored
Merge pull request #1307 from Libensemble/experimental/jlnav_plus_shuds_asktell
ASK/TELL DEVELOP
2 parents fd154a0 + 005647f commit 699d7ca

74 files changed

Lines changed: 4685 additions & 524 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ ignore:
44
- "libensemble/tools/live_data/*"
55
- "libensemble/sim_funcs/executor_hworld.py"
66
- "libensemble/gen_funcs/persistent_tasmanian.py"
7+
- "libensemble/gen_classes/gpCAM.py"

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ per-file-ignores =
3838

3939
# Need to set something before the APOSMM import
4040
libensemble/tests/regression_tests/test_persistent_aposmm*:E402
41+
libensemble/tests/regression_tests/test_asktell_aposmm_nlopt.py:E402
4142
libensemble/tests/regression_tests/test_persistent_gp_multitask_ax.py:E402
4243
libensemble/tests/functionality_tests/test_uniform_sampling_then_persistent_localopt_runs.py:E402
4344
libensemble/tests/functionality_tests/test_stats_output.py:E402

.github/workflows/extra.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,22 @@ jobs:
7070
run: |
7171
pixi run -e ${{ matrix.python-version }} pip install gpcam==8.1.13
7272
73+
- name: Remove xopt tests on old python
74+
if: matrix.python-version == 'py310e'
75+
run: |
76+
rm ./libensemble/tests/regression_tests/test_xopt_EI_xopt_sim.py
77+
rm ./libensemble/tests/regression_tests/test_xopt_EI.py
78+
rm ./libensemble/tests/regression_tests/test_xopt_nelder_mead.py
79+
7380
- name: Remove test using octave, gpcam, globus-compute on Python 3.13
7481
if: matrix.python-version == 'py313e' || matrix.python-version == 'py314e'
7582
run: |
7683
rm ./libensemble/tests/unit_tests/test_ufunc_runners.py # needs globus-compute
77-
rm ./libensemble/tests/regression_tests/test_persistent_fd_param_finder.py # needs octave, which doesn't yet support 3.13
78-
rm ./libensemble/tests/regression_tests/test_persistent_aposmm_external_localopt.py # needs octave, which doesn't yet support 3.13
7984
rm ./libensemble/tests/regression_tests/test_gpCAM.py # needs gpcam, which doesn't build on 3.13
85+
rm ./libensemble/tests/regression_tests/test_asktell_gpCAM.py # needs gpcam, which doesn't build on 3.13
8086
rm ./libensemble/tests/regression_tests/test_persistent_gp_multitask_ax.py # needs ax-platform, which doesn't yet support 3.14
87+
rm ./libensemble/tests/regression_tests/test_optimas_ax_mf.py # needs ax-platform, which doesn't yet support 3.14
88+
rm ./libensemble/tests/regression_tests/test_optimas_ax_sf.py # needs ax-platform, which doesn't yet support 3.14
8189
8290
- name: Start Redis
8391
if: matrix.os == 'ubuntu-latest'

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: end-of-file-fixer
66
exclude: ^(.*\.xml|.*\.svg)$
77
- id: trailing-whitespace
88
exclude: ^(.*\.xml|.*\.svg)$
99

1010
- repo: https://github.com/pycqa/isort
11-
rev: 6.0.0
11+
rev: 7.0.0
1212
hooks:
1313
- id: isort
1414
args: [--profile=black, --line-length=120]
1515

1616
- repo: https://github.com/psf/black
17-
rev: 25.1.0
17+
rev: 25.12.0
1818
hooks:
1919
- id: black
2020
args: [--line-length=120]
2121

2222
- repo: https://github.com/PyCQA/flake8
23-
rev: 7.1.1
23+
rev: 7.3.0
2424
hooks:
2525
- id: flake8
2626
args: [--max-line-length=120]
2727

2828
- repo: https://github.com/asottile/blacken-docs
29-
rev: 1.19.1
29+
rev: 1.20.0
3030
hooks:
3131
- id: blacken-docs
3232
additional_dependencies: [black==22.12.0]

README.rst

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,46 +44,52 @@ and an exit condition. Run the following four-worker example via ``python this_f
4444
4545
import numpy as np
4646
47+
from gest_api.vocs import VOCS
48+
4749
from libensemble import Ensemble
48-
from libensemble.gen_funcs.sampling import uniform_random_sample
50+
from libensemble.gen_classes.sampling import UniformSample
4951
from libensemble.sim_funcs.six_hump_camel import six_hump_camel
5052
from libensemble.specs import ExitCriteria, GenSpecs, LibeSpecs, SimSpecs
5153
5254
if __name__ == "__main__":
5355
5456
libE_specs = LibeSpecs(nworkers=4)
5557
58+
variables_objectives = VOCS(
59+
variables={
60+
"x0": [-3, 3],
61+
"x1": [-2, 2],
62+
},
63+
objectives={"f": "EXPLORE"},
64+
)
65+
66+
generator = UniformSample(vocs=variables_objectives)
67+
5668
sim_specs = SimSpecs(
5769
sim_f=six_hump_camel,
58-
inputs=["x"],
59-
outputs=[("f", float)],
70+
vocs=variables_objectives,
6071
)
6172
6273
gen_specs = GenSpecs(
63-
gen_f=uniform_random_sample,
64-
outputs=[("x", float, 2)],
65-
user={
66-
"gen_batch_size": 50,
67-
"lb": np.array([-3, -2]),
68-
"ub": np.array([3, 2]),
69-
},
74+
generator=generator,
75+
vocs=variables_objectives,
7076
)
7177
7278
exit_criteria = ExitCriteria(sim_max=100)
7379
74-
sampling = Ensemble(
80+
ensemble = Ensemble(
7581
libE_specs=libE_specs,
7682
sim_specs=sim_specs,
7783
gen_specs=gen_specs,
7884
exit_criteria=exit_criteria,
7985
)
8086
81-
sampling.add_random_streams()
82-
sampling.run()
87+
ensemble.add_random_streams()
88+
ensemble.run()
8389
84-
if sampling.is_manager:
85-
sampling.save_output(__file__)
86-
print("Some output data:\n", sampling.H[["x", "f"]][:10])
90+
if ensemble.is_manager:
91+
ensemble.save_output(__file__)
92+
print("Some output data:\n", ensemble.H[["x", "f"]][:10])
8793
8894
|Inline Example|
8995

docs/advanced_installation.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
Advanced Installation
22
=====================
33

4-
libEnsemble can be installed from ``pip``, ``Conda``, or ``Spack``.
4+
libEnsemble can be installed from ``pip``, ``uv``, ``Conda``, or ``Spack``.
55

66
libEnsemble requires the following dependencies, which are typically
77
automatically installed alongside libEnsemble:
88

99
* Python_ ``>= 3.10``
1010
* NumPy_ ``>= 1.21``
1111
* psutil_ ``>= 5.9.4``
12-
* `pydantic`_ ``>= 1.10.12``
12+
* `pydantic`_ ``>= 2``
1313
* pyyaml_ ``>= v6.0``
1414
* tomli_ ``>= 1.2.1``
15+
* gest-api_ ``>= 0.1,<0.2``
1516

16-
Given libEnsemble's compiled dependencies, the following installation
17-
methods each offer a trade-off between convenience and the ability
18-
to customize builds, including platform-specific optimizations.
19-
20-
We always recommend installing in a virtual environment from Conda or another source.
17+
We recommend installing in a virtual environment from ``uv``, ``conda`` or another source.
2118

2219
Further recommendations for selected HPC systems are given in the
2320
:ref:`HPC platform guides<platform-index>`.
@@ -53,6 +50,12 @@ Further recommendations for selected HPC systems are given in the
5350

5451
CC=mpicc MPICC=mpicc pip install mpi4py --no-binary mpi4py
5552

53+
.. tab-item:: uv
54+
55+
To install the latest PyPI_ release via uv_::
56+
57+
uv pip install libensemble
58+
5659
.. tab-item:: conda
5760

5861
Install libEnsemble with Conda_ from the conda-forge channel::
@@ -178,6 +181,7 @@ The following packages may be installed separately to enable additional features
178181

179182
.. _conda-forge: https://conda-forge.org/
180183
.. _Conda: https://docs.conda.io/en/latest/
184+
.. _gest-api: https://github.com/campa-consortium/gest-api
181185
.. _GitHub: https://github.com/Libensemble/libensemble
182186
.. _Globus Compute: https://www.globus.org/compute
183187
.. _MPICH: https://www.mpich.org/
@@ -192,3 +196,4 @@ The following packages may be installed separately to enable additional features
192196
.. _spack_libe: https://github.com/Libensemble/spack_libe
193197
.. _tomli: https://pypi.org/project/tomli/
194198
.. _tqdm: https://tqdm.github.io/
199+
.. _uv: https://docs.astral.sh/uv/

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class AxParameterWarning(Warning): # Ensure it's a real warning subclass
6767

6868
# sys.path.insert(0, os.path.abspath('.'))
6969
sys.path.append(os.path.abspath("../libensemble"))
70-
##sys.path.append(os.path.abspath('../libensemble'))
7170
sys.path.append(os.path.abspath("../libensemble/alloc_funcs"))
7271
sys.path.append(os.path.abspath("../libensemble/gen_funcs"))
72+
sys.path.append(os.path.abspath("../libensemble/gen_classes"))
7373
sys.path.append(os.path.abspath("../libensemble/sim_funcs"))
7474
sys.path.append(os.path.abspath("../libensemble/comms"))
7575
sys.path.append(os.path.abspath("../libensemble/utils"))

docs/data_structures/gen_specs.rst

Lines changed: 30 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,89 +3,36 @@
33
Generator Specs
44
===============
55

6-
Used to specify the generator function, its inputs and outputs, and user data.
7-
8-
Can be constructed and passed to libEnsemble as a Python class or a dictionary.
9-
10-
.. tab-set::
11-
12-
.. tab-item:: class
13-
14-
.. code-block:: python
15-
:linenos:
16-
17-
...
18-
import numpy as np
19-
from libensemble import GenSpecs
20-
from generator import gen_random_sample
21-
22-
...
23-
24-
gen_specs = GenSpecs(
25-
gen_f=gen_random_sample,
26-
outputs=[("x", float, (1,))],
27-
user={
28-
"lower": np.array([-3]),
29-
"upper": np.array([3]),
30-
"gen_batch_size": 5,
31-
},
32-
)
33-
...
34-
35-
.. autopydantic_model:: libensemble.specs.GenSpecs
36-
:model-show-json: False
37-
:model-show-config-member: False
38-
:model-show-config-summary: False
39-
:model-show-validator-members: False
40-
:model-show-validator-summary: False
41-
:field-list-validators: False
42-
43-
.. tab-item:: dict
44-
45-
.. code-block:: python
46-
:linenos:
47-
48-
...
49-
import numpy as np
50-
from generator import gen_random_sample
51-
52-
...
53-
54-
gen_specs = {
55-
"gen_f": gen_random_sample,
56-
"out": [("x", float, (1,))],
57-
"user": {
58-
"lower": np.array([-3]),
59-
"upper": np.array([3]),
60-
"gen_batch_size": 5,
61-
},
62-
}
63-
64-
.. seealso::
65-
66-
.. _gen-specs-example1:
67-
68-
- test_uniform_sampling.py_:
69-
the generator function ``uniform_random_sample`` in sampling.py_ will generate 500 random
70-
points uniformly over the 2D domain defined by ``gen_specs["ub"]`` and
71-
``gen_specs["lb"]``.
72-
73-
.. literalinclude:: ../../libensemble/tests/functionality_tests/test_uniform_sampling.py
74-
:start-at: gen_specs
75-
:end-before: end_gen_specs_rst_tag
76-
77-
.. seealso::
78-
79-
- test_persistent_aposmm_nlopt.py_ shows an example where ``gen_specs["in"]`` is empty, but
80-
``gen_specs["persis_in"]`` specifies values to return to the persistent generator.
81-
82-
- test_persistent_aposmm_with_grad.py_ shows a similar example where an ``H0`` is used to
83-
provide points from a previous run. In this case, ``gen_specs["in"]`` is populated to provide
84-
the generator with data for the initial points.
85-
86-
- In some cases you might be able to give different (perhaps fewer) fields in ``"persis_in"``
87-
than ``"in"``; you may not need to give ``x`` for example, as the persistent generator
88-
already has ``x`` for those points. See `more example uses`_ of ``persis_in``.
6+
Used to specify the generator, its inputs and outputs, and user data.
7+
8+
.. code-block:: python
9+
:linenos:
10+
11+
...
12+
import numpy as np
13+
from libensemble import GenSpecs
14+
from generator import gen_random_sample
15+
16+
...
17+
18+
gen_specs = GenSpecs(
19+
gen_f=gen_random_sample,
20+
outputs=[("x", float, (1,))],
21+
user={
22+
"lower": np.array([-3]),
23+
"upper": np.array([3]),
24+
"gen_batch_size": 5,
25+
},
26+
)
27+
...
28+
29+
.. autopydantic_model:: libensemble.specs.GenSpecs
30+
:model-show-json: False
31+
:model-show-config-member: False
32+
:model-show-config-summary: False
33+
:model-show-validator-members: False
34+
:model-show-validator-summary: False
35+
:field-list-validators: False
8936

9037
.. note::
9138

docs/data_structures/libE_specs.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@
33
LibE Specs
44
==========
55

6-
libEnsemble is primarily customized by setting options within a ``LibeSpecs`` class or dictionary.
6+
libEnsemble is primarily customized by setting options within a ``LibeSpecs`` instance.
77

88
.. code-block:: python
99
1010
from libensemble.specs import LibeSpecs
1111
12-
specs = LibeSpecs(
13-
gen_on_manager=True,
14-
save_every_k_gens=100,
15-
sim_dirs_make=True,
16-
nworkers=4
17-
)
12+
specs = LibeSpecs(gen_on_manager=True, save_every_k_gens=100, sim_dirs_make=True, nworkers=4)
1813
1914
.. dropdown:: Settings by Category
2015
:open:

0 commit comments

Comments
 (0)