l2co-tasks 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- l2co_tasks-0.1.0/LICENSE +28 -0
- l2co_tasks-0.1.0/MANIFEST.in +3 -0
- l2co_tasks-0.1.0/PKG-INFO +138 -0
- l2co_tasks-0.1.0/README.md +89 -0
- l2co_tasks-0.1.0/pyproject.toml +120 -0
- l2co_tasks-0.1.0/setup.cfg +4 -0
- l2co_tasks-0.1.0/src/l2co_tasks/__init__.py +71 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/__init__.py +5 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/_io.py +56 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/benchmark_task.py +325 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/cifar10_task.py +79 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/continue_from_path.py +29 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/euler.py +613 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/experimentdata.py +147 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/gaussian_meta.py +213 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/helmholtz.py +323 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/inviscid_burgers.py +357 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/loss_fn.py +107 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/mnist1d_task.py +113 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/models.py +646 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/pde.py +650 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/pinn.py +112 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/pkpd.py +435 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/quadratic_task.py +202 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/spiral_task.py +137 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/stokes.py +373 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/task.py +463 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/task_gaussian_class.py +216 -0
- l2co_tasks-0.1.0/src/l2co_tasks/_src/viscous_burgers.py +365 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/__init__.py +5 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/__init__.py +0 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/bbob.yaml +65 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/bbob2.yaml +64 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/bbob_holdout.yaml +43 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/bbob_single.yaml +36 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/bbob_small.yaml +52 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/bbob_test.yaml +53 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/cec2005.yaml +62 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/cec2005_small.yaml +60 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/euler.yaml +25 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/gaussian_classification.yaml +48 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/gaussian_meta.yaml +31 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/helmholtz.yaml +27 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/inviscid_burgers.yaml +25 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/mnist1d.yaml +28 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/pde.yaml +30 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/pkpd.yaml +25 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/quadratic.yaml +32 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/spirals.yaml +29 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/stokes.yaml +25 -0
- l2co_tasks-0.1.0/src/l2co_tasks/conf/tasks/viscous_burgers.yaml +25 -0
- l2co_tasks-0.1.0/src/l2co_tasks/tasks.py +49 -0
- l2co_tasks-0.1.0/src/l2co_tasks.egg-info/PKG-INFO +138 -0
- l2co_tasks-0.1.0/src/l2co_tasks.egg-info/SOURCES.txt +80 -0
- l2co_tasks-0.1.0/src/l2co_tasks.egg-info/dependency_links.txt +1 -0
- l2co_tasks-0.1.0/src/l2co_tasks.egg-info/requires.txt +33 -0
- l2co_tasks-0.1.0/src/l2co_tasks.egg-info/top_level.txt +1 -0
- l2co_tasks-0.1.0/tests/test_benchmark_task.py +96 -0
- l2co_tasks-0.1.0/tests/test_conf_tasks.py +302 -0
- l2co_tasks-0.1.0/tests/test_continue_from_path.py +35 -0
- l2co_tasks-0.1.0/tests/test_euler.py +68 -0
- l2co_tasks-0.1.0/tests/test_gaussian_meta.py +28 -0
- l2co_tasks-0.1.0/tests/test_helmholtz.py +77 -0
- l2co_tasks-0.1.0/tests/test_inviscid_burgers.py +63 -0
- l2co_tasks-0.1.0/tests/test_l2co_integration.py +209 -0
- l2co_tasks-0.1.0/tests/test_loss_fn.py +78 -0
- l2co_tasks-0.1.0/tests/test_mnist1d_task.py +64 -0
- l2co_tasks-0.1.0/tests/test_models.py +151 -0
- l2co_tasks-0.1.0/tests/test_pde_task.py +80 -0
- l2co_tasks-0.1.0/tests/test_pkpd.py +90 -0
- l2co_tasks-0.1.0/tests/test_quadratic_task.py +44 -0
- l2co_tasks-0.1.0/tests/test_smoke.py +35 -0
- l2co_tasks-0.1.0/tests/test_spiral_task.py +73 -0
- l2co_tasks-0.1.0/tests/test_stokes.py +56 -0
- l2co_tasks-0.1.0/tests/test_task.py +139 -0
- l2co_tasks-0.1.0/tests/test_task_contract.py +300 -0
- l2co_tasks-0.1.0/tests/test_task_gaussian_class.py +57 -0
- l2co_tasks-0.1.0/tests/test_task_io.py +131 -0
- l2co_tasks-0.1.0/tests/test_task_optimizability.py +130 -0
- l2co_tasks-0.1.0/tests/test_task_registry_guard.py +47 -0
- l2co_tasks-0.1.0/tests/test_task_values.py +290 -0
- l2co_tasks-0.1.0/tests/test_viscous_burgers.py +56 -0
l2co_tasks-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Martin van der Schelling
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: l2co-tasks
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Optimization tasks compatible with the L2CO library
|
|
5
|
+
Author-email: Martin van der Schelling <m.p.vanderschelling@tudelft.nl>
|
|
6
|
+
Maintainer-email: Martin van der Schelling <m.p.vanderschelling@tudelft.nl>
|
|
7
|
+
License-Expression: BSD-3-Clause
|
|
8
|
+
Project-URL: bugs, https://github.com/bessagroup/l2co-tasks/issues
|
|
9
|
+
Project-URL: homepage, https://github.com/bessagroup/l2co-tasks
|
|
10
|
+
Keywords: optimization,tasks,benchmarking
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: bbob-jax>=1.6.4
|
|
19
|
+
Requires-Dist: cloudpickle>=3.1.1
|
|
20
|
+
Requires-Dist: equinox>=0.13.0
|
|
21
|
+
Requires-Dist: f3dasm
|
|
22
|
+
Requires-Dist: hydra-core>=1.3.2
|
|
23
|
+
Requires-Dist: jax
|
|
24
|
+
Requires-Dist: jaxtyping>=0.3.2
|
|
25
|
+
Requires-Dist: mnist1d
|
|
26
|
+
Requires-Dist: numpy
|
|
27
|
+
Requires-Dist: omegaconf
|
|
28
|
+
Requires-Dist: optax>=0.2.5
|
|
29
|
+
Requires-Dist: pandas
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: setuptools>=77.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: build; extra == "dev"
|
|
33
|
+
Requires-Dist: wheel; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit>=4.4.0; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff>=0.14.10; extra == "dev"
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: mkdocs>=1.6.0; extra == "docs"
|
|
38
|
+
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "docs"
|
|
39
|
+
Requires-Dist: mkdocs-include-exclude-files>=0.1.0; extra == "docs"
|
|
40
|
+
Requires-Dist: mkdocs-ipynb>=0.1.1; extra == "docs"
|
|
41
|
+
Requires-Dist: mkdocs-material>=9.6.20; extra == "docs"
|
|
42
|
+
Requires-Dist: mkdocstrings>=0.30.1; extra == "docs"
|
|
43
|
+
Requires-Dist: mkdocstrings-python>=1.18.2; extra == "docs"
|
|
44
|
+
Requires-Dist: pymdown-extensions>=10.16.1; extra == "docs"
|
|
45
|
+
Provides-Extra: tests
|
|
46
|
+
Requires-Dist: pytest>=8.4.1; extra == "tests"
|
|
47
|
+
Requires-Dist: pytest-cov>=6.2.1; extra == "tests"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
# L2CO Tasks
|
|
53
|
+
|
|
54
|
+
| [**GitHub**](https://github.com/bessagroup/l2co-tasks)
|
|
55
|
+
| [**Documentation**](https://l2co-tasks.readthedocs.io/en/latest/)
|
|
56
|
+
|
|
57
|
+
Optimization tasks compatible with the L2CO library
|
|
58
|
+
|
|
59
|
+
**First publication:** April 13, 2026
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
## Summary
|
|
64
|
+
|
|
65
|
+
`l2co-tasks` provides a unified collection of optimization tasks for the [L2CO](https://github.com/bessagroup/l2co) ecosystem. Each `Task` bundles a JAX/Equinox model, a loss function, an optional dataset, and metadata tags into a single, serializable object that any L2CO optimizer or rollout can consume. The package ships ready-made task families — analytic black-box benchmarks ([BBOB](https://github.com/bessagroup/bbob-jax) and CEC 2005), quadratic problems, supervised-learning tasks (spiral, MNIST-1D, Gaussian classification), and PINN-style PDE problems (convection, reaction, wave) — together with `create_*_task` factories and `f3dasm` samplers for building experiment datasets.
|
|
66
|
+
|
|
67
|
+
## Statement of need
|
|
68
|
+
|
|
69
|
+
Research on learning to optimize and optimizer selection requires evaluating many optimizers across a diverse, well-characterized set of problems — but these problems usually come from incompatible sources with different input ranges, calling conventions, and metadata. `l2co-tasks` standardizes them behind a single `Task` abstraction: inputs are normalized to `[0, 1]^d` and scaled inside the loss, stochasticity and known global minima are tracked explicitly, and every task carries a hashable tag and serializes to a single `.eqx` file. This makes tasks reproducible, portable, and directly pluggable into the [`l2co`](https://github.com/bessagroup/l2co) / [`rl2co`](https://github.com/bessagroup/rl2co) rollout machinery and [`f3dasm`](https://github.com/bessagroup/f3dasm) experiment pipelines.
|
|
70
|
+
|
|
71
|
+
## Authorship
|
|
72
|
+
|
|
73
|
+
**Authors**:
|
|
74
|
+
- Martin van der Schelling ([m.p.vanderschelling@tudelft.nl](mailto:m.p.vanderschelling@tudelft.nl))
|
|
75
|
+
|
|
76
|
+
**Authors affiliation:**
|
|
77
|
+
- Delft University of Technology (Bessa Research Group)
|
|
78
|
+
|
|
79
|
+
**Maintainer:**
|
|
80
|
+
- Martin van der Schelling ([m.p.vanderschelling@tudelft.nl](mailto:m.p.vanderschelling@tudelft.nl))
|
|
81
|
+
|
|
82
|
+
**Maintainer affiliation:**
|
|
83
|
+
- Delft University of Technology (Bessa Research Group)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Getting started
|
|
87
|
+
|
|
88
|
+
`l2co-tasks` is `uv`-managed and depends on an editable install of a sibling [`f3dasm`](https://github.com/bessagroup/f3dasm) checkout, so lay the repositories out side-by-side before syncing:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git clone https://github.com/bessagroup/f3dasm.git
|
|
92
|
+
git clone https://github.com/bessagroup/l2co-tasks.git
|
|
93
|
+
cd l2co-tasks
|
|
94
|
+
uv sync
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Create a task from one of the factories and evaluate its loss:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from l2co_tasks import create_bbob_task
|
|
101
|
+
|
|
102
|
+
task = create_bbob_task(fn_name="sphere", seed=0, dimensionality=2)
|
|
103
|
+
loss = task.loss_fn(task.model) # model is the [0, 1]^d input vector
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Tasks serialize to a single-file `.eqx` format via `Task.save` / `Task.load`. See the [documentation](https://l2co-tasks.readthedocs.io/en/latest/) for the full list of task families and `create_*_task` factories. To build your own task from scratch, see the [Create your own task](./docs/create_task.ipynb) guide.
|
|
107
|
+
|
|
108
|
+
## Examples and benchmarks
|
|
109
|
+
|
|
110
|
+
Two runnable notebooks demonstrate and benchmark the core functionality end-to-end. Both run against the installed package after `uv sync` and are rendered in the [documentation](https://l2co-tasks.readthedocs.io/en/latest/):
|
|
111
|
+
|
|
112
|
+
- [Create your own task](./docs/create_task.ipynb) — builds a `Task` from scratch and exercises the `Task` API (loss evaluation, serialization, metadata).
|
|
113
|
+
- [PINN benchmark tasks](./docs/pinn_tasks.ipynb) — instantiates and evaluates the physics-informed PDE benchmark suite (Helmholtz, Burgers, Euler, Stokes, PK–PD).
|
|
114
|
+
|
|
115
|
+
## Community Support
|
|
116
|
+
|
|
117
|
+
If you find any **issues, bugs or problems** with this package, please use the [GitHub issue tracker](https://github.com/bessagroup/l2co-tasks/issues) to report them.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
Copyright (c) 2026, Martin van der Schelling
|
|
122
|
+
|
|
123
|
+
All rights reserved.
|
|
124
|
+
|
|
125
|
+
This project is licensed under the BSD 3-Clause License. See [LICENSE](https://github.com/bessagroup/l2co-tasks/blob/main/LICENSE) for the full license text.
|
|
126
|
+
|
|
127
|
+
## Related repositories
|
|
128
|
+
|
|
129
|
+
This package is part of the L2CO ecosystem developed in the [Bessa Research Group](https://github.com/bessagroup). The repositories below work together:
|
|
130
|
+
|
|
131
|
+
- [l2co](https://github.com/bessagroup/L2CO) — Learning to Choose Optimizers: a meta-learner that selects an optimizer from problem features before any evaluations, then reassesses that choice from the observed optimization trajectory.
|
|
132
|
+
- [rl2co](https://github.com/bessagroup/rl2co) — Reinforcement Learning to Choose Optimizers: a JAX-based RL agent that dynamically switches between optimizers during a run.
|
|
133
|
+
- [l2co-tasks](https://github.com/bessagroup/l2co-tasks) — Optimization task definitions (BBOB, CEC 2005, PDE, spiral, …) compatible with the L2CO library.
|
|
134
|
+
- [l2co_experiments](https://github.com/bessagroup/l2co_experiments) — Hydra + f3dasm experiment pipelines (dataset creation, training, rollouts, figures) for the L2CO studies.
|
|
135
|
+
- [agentic-l2co](https://github.com/bessagroup/agentic-l2co) — An LLM-agent drop-in replacement for `l2co.L2COModel`, driving two-stage optimizer selection with an Ollama-hosted LLM.
|
|
136
|
+
- [bbob-jax](https://github.com/bessagroup/bbob-jax) — JAX implementations of the BBOB and CEC 2005 black-box optimization benchmark functions.
|
|
137
|
+
- [f3dasm](https://github.com/bessagroup/f3dasm) — Framework for Data-Driven Design and Analysis of Structures and Materials; provides `ExperimentData`, pipelines, and SLURM orchestration.
|
|
138
|
+
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# L2CO Tasks
|
|
4
|
+
|
|
5
|
+
| [**GitHub**](https://github.com/bessagroup/l2co-tasks)
|
|
6
|
+
| [**Documentation**](https://l2co-tasks.readthedocs.io/en/latest/)
|
|
7
|
+
|
|
8
|
+
Optimization tasks compatible with the L2CO library
|
|
9
|
+
|
|
10
|
+
**First publication:** April 13, 2026
|
|
11
|
+
|
|
12
|
+
***
|
|
13
|
+
|
|
14
|
+
## Summary
|
|
15
|
+
|
|
16
|
+
`l2co-tasks` provides a unified collection of optimization tasks for the [L2CO](https://github.com/bessagroup/l2co) ecosystem. Each `Task` bundles a JAX/Equinox model, a loss function, an optional dataset, and metadata tags into a single, serializable object that any L2CO optimizer or rollout can consume. The package ships ready-made task families — analytic black-box benchmarks ([BBOB](https://github.com/bessagroup/bbob-jax) and CEC 2005), quadratic problems, supervised-learning tasks (spiral, MNIST-1D, Gaussian classification), and PINN-style PDE problems (convection, reaction, wave) — together with `create_*_task` factories and `f3dasm` samplers for building experiment datasets.
|
|
17
|
+
|
|
18
|
+
## Statement of need
|
|
19
|
+
|
|
20
|
+
Research on learning to optimize and optimizer selection requires evaluating many optimizers across a diverse, well-characterized set of problems — but these problems usually come from incompatible sources with different input ranges, calling conventions, and metadata. `l2co-tasks` standardizes them behind a single `Task` abstraction: inputs are normalized to `[0, 1]^d` and scaled inside the loss, stochasticity and known global minima are tracked explicitly, and every task carries a hashable tag and serializes to a single `.eqx` file. This makes tasks reproducible, portable, and directly pluggable into the [`l2co`](https://github.com/bessagroup/l2co) / [`rl2co`](https://github.com/bessagroup/rl2co) rollout machinery and [`f3dasm`](https://github.com/bessagroup/f3dasm) experiment pipelines.
|
|
21
|
+
|
|
22
|
+
## Authorship
|
|
23
|
+
|
|
24
|
+
**Authors**:
|
|
25
|
+
- Martin van der Schelling ([m.p.vanderschelling@tudelft.nl](mailto:m.p.vanderschelling@tudelft.nl))
|
|
26
|
+
|
|
27
|
+
**Authors affiliation:**
|
|
28
|
+
- Delft University of Technology (Bessa Research Group)
|
|
29
|
+
|
|
30
|
+
**Maintainer:**
|
|
31
|
+
- Martin van der Schelling ([m.p.vanderschelling@tudelft.nl](mailto:m.p.vanderschelling@tudelft.nl))
|
|
32
|
+
|
|
33
|
+
**Maintainer affiliation:**
|
|
34
|
+
- Delft University of Technology (Bessa Research Group)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Getting started
|
|
38
|
+
|
|
39
|
+
`l2co-tasks` is `uv`-managed and depends on an editable install of a sibling [`f3dasm`](https://github.com/bessagroup/f3dasm) checkout, so lay the repositories out side-by-side before syncing:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/bessagroup/f3dasm.git
|
|
43
|
+
git clone https://github.com/bessagroup/l2co-tasks.git
|
|
44
|
+
cd l2co-tasks
|
|
45
|
+
uv sync
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Create a task from one of the factories and evaluate its loss:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from l2co_tasks import create_bbob_task
|
|
52
|
+
|
|
53
|
+
task = create_bbob_task(fn_name="sphere", seed=0, dimensionality=2)
|
|
54
|
+
loss = task.loss_fn(task.model) # model is the [0, 1]^d input vector
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Tasks serialize to a single-file `.eqx` format via `Task.save` / `Task.load`. See the [documentation](https://l2co-tasks.readthedocs.io/en/latest/) for the full list of task families and `create_*_task` factories. To build your own task from scratch, see the [Create your own task](./docs/create_task.ipynb) guide.
|
|
58
|
+
|
|
59
|
+
## Examples and benchmarks
|
|
60
|
+
|
|
61
|
+
Two runnable notebooks demonstrate and benchmark the core functionality end-to-end. Both run against the installed package after `uv sync` and are rendered in the [documentation](https://l2co-tasks.readthedocs.io/en/latest/):
|
|
62
|
+
|
|
63
|
+
- [Create your own task](./docs/create_task.ipynb) — builds a `Task` from scratch and exercises the `Task` API (loss evaluation, serialization, metadata).
|
|
64
|
+
- [PINN benchmark tasks](./docs/pinn_tasks.ipynb) — instantiates and evaluates the physics-informed PDE benchmark suite (Helmholtz, Burgers, Euler, Stokes, PK–PD).
|
|
65
|
+
|
|
66
|
+
## Community Support
|
|
67
|
+
|
|
68
|
+
If you find any **issues, bugs or problems** with this package, please use the [GitHub issue tracker](https://github.com/bessagroup/l2co-tasks/issues) to report them.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
Copyright (c) 2026, Martin van der Schelling
|
|
73
|
+
|
|
74
|
+
All rights reserved.
|
|
75
|
+
|
|
76
|
+
This project is licensed under the BSD 3-Clause License. See [LICENSE](https://github.com/bessagroup/l2co-tasks/blob/main/LICENSE) for the full license text.
|
|
77
|
+
|
|
78
|
+
## Related repositories
|
|
79
|
+
|
|
80
|
+
This package is part of the L2CO ecosystem developed in the [Bessa Research Group](https://github.com/bessagroup). The repositories below work together:
|
|
81
|
+
|
|
82
|
+
- [l2co](https://github.com/bessagroup/L2CO) — Learning to Choose Optimizers: a meta-learner that selects an optimizer from problem features before any evaluations, then reassesses that choice from the observed optimization trajectory.
|
|
83
|
+
- [rl2co](https://github.com/bessagroup/rl2co) — Reinforcement Learning to Choose Optimizers: a JAX-based RL agent that dynamically switches between optimizers during a run.
|
|
84
|
+
- [l2co-tasks](https://github.com/bessagroup/l2co-tasks) — Optimization task definitions (BBOB, CEC 2005, PDE, spiral, …) compatible with the L2CO library.
|
|
85
|
+
- [l2co_experiments](https://github.com/bessagroup/l2co_experiments) — Hydra + f3dasm experiment pipelines (dataset creation, training, rollouts, figures) for the L2CO studies.
|
|
86
|
+
- [agentic-l2co](https://github.com/bessagroup/agentic-l2co) — An LLM-agent drop-in replacement for `l2co.L2COModel`, driving two-stage optimizer selection with an Ollama-hosted LLM.
|
|
87
|
+
- [bbob-jax](https://github.com/bessagroup/bbob-jax) — JAX implementations of the BBOB and CEC 2005 black-box optimization benchmark functions.
|
|
88
|
+
- [f3dasm](https://github.com/bessagroup/f3dasm) — Framework for Data-Driven Design and Analysis of Structures and Materials; provides `ExperimentData`, pipelines, and SLURM orchestration.
|
|
89
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "setuptools.build_meta"
|
|
3
|
+
requires = ["setuptools>=77.0.0", "wheel"]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
authors = [
|
|
7
|
+
{email = "m.p.vanderschelling@tudelft.nl", name = "Martin van der Schelling"}
|
|
8
|
+
]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Intended Audience :: Science/Research",
|
|
11
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
12
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
13
|
+
"Programming Language :: Python :: 3"
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"bbob-jax>=1.6.4",
|
|
17
|
+
"cloudpickle>=3.1.1",
|
|
18
|
+
"equinox>=0.13.0",
|
|
19
|
+
"f3dasm",
|
|
20
|
+
"hydra-core>=1.3.2",
|
|
21
|
+
"jax",
|
|
22
|
+
"jaxtyping>=0.3.2",
|
|
23
|
+
"mnist1d",
|
|
24
|
+
"numpy",
|
|
25
|
+
"omegaconf",
|
|
26
|
+
"optax>=0.2.5",
|
|
27
|
+
"pandas"
|
|
28
|
+
]
|
|
29
|
+
description = "Optimization tasks compatible with the L2CO library"
|
|
30
|
+
keywords = ["optimization", "tasks", "benchmarking"]
|
|
31
|
+
license = "BSD-3-Clause"
|
|
32
|
+
maintainers = [
|
|
33
|
+
{email = "m.p.vanderschelling@tudelft.nl", name = "Martin van der Schelling"}
|
|
34
|
+
]
|
|
35
|
+
name = "l2co-tasks"
|
|
36
|
+
readme = "README.md"
|
|
37
|
+
requires-python = ">= 3.12"
|
|
38
|
+
version = "0.1.0"
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
dev = [
|
|
42
|
+
"setuptools>=77.0.0",
|
|
43
|
+
"build",
|
|
44
|
+
"wheel",
|
|
45
|
+
"pre-commit>=4.4.0",
|
|
46
|
+
"ruff>=0.14.10"
|
|
47
|
+
]
|
|
48
|
+
docs = [
|
|
49
|
+
"mkdocs>=1.6.0",
|
|
50
|
+
"mkdocs-gen-files>=0.5.0",
|
|
51
|
+
"mkdocs-include-exclude-files>=0.1.0",
|
|
52
|
+
"mkdocs-ipynb>=0.1.1",
|
|
53
|
+
"mkdocs-material>=9.6.20",
|
|
54
|
+
"mkdocstrings>=0.30.1",
|
|
55
|
+
"mkdocstrings-python>=1.18.2",
|
|
56
|
+
"pymdown-extensions>=10.16.1"
|
|
57
|
+
]
|
|
58
|
+
tests = [
|
|
59
|
+
"pytest>=8.4.1",
|
|
60
|
+
"pytest-cov>=6.2.1"
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[project.urls]
|
|
64
|
+
bugs = "https://github.com/bessagroup/l2co-tasks/issues"
|
|
65
|
+
homepage = "https://github.com/bessagroup/l2co-tasks"
|
|
66
|
+
|
|
67
|
+
[tool.pytest.ini_options]
|
|
68
|
+
filterwarnings = [
|
|
69
|
+
"error::DeprecationWarning:l2co_tasks"
|
|
70
|
+
]
|
|
71
|
+
markers = [
|
|
72
|
+
"slow: test writes a dataset .npz or runs an inner training loop",
|
|
73
|
+
"requires_f3dasm: test constructs an f3dasm.ExperimentData",
|
|
74
|
+
"requires_l2co: drives tasks through l2co (skipped unless l2co imports)"
|
|
75
|
+
]
|
|
76
|
+
testpaths = ["tests"]
|
|
77
|
+
|
|
78
|
+
[tool.ruff]
|
|
79
|
+
line-length = 79
|
|
80
|
+
|
|
81
|
+
[tool.ruff.lint]
|
|
82
|
+
exclude = [
|
|
83
|
+
"__pycache__",
|
|
84
|
+
"dist",
|
|
85
|
+
"*.egg",
|
|
86
|
+
"tests",
|
|
87
|
+
".git"
|
|
88
|
+
]
|
|
89
|
+
ignore = [
|
|
90
|
+
"E226",
|
|
91
|
+
"E3",
|
|
92
|
+
"E731",
|
|
93
|
+
"C901",
|
|
94
|
+
"UP045",
|
|
95
|
+
"B027",
|
|
96
|
+
"B012"
|
|
97
|
+
]
|
|
98
|
+
select = [
|
|
99
|
+
"E", # pycodestyle errors
|
|
100
|
+
"W", # pycodestyle warnings
|
|
101
|
+
"F", # Pyflakes
|
|
102
|
+
"I", # isort
|
|
103
|
+
"B", # flake8-bugbear
|
|
104
|
+
"UP" # pyupgrade
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[tool.ruff.lint.per-file-ignores]
|
|
108
|
+
"__init__.py" = ["F401", "E402"]
|
|
109
|
+
|
|
110
|
+
[tool.ruff.lint.pydocstyle]
|
|
111
|
+
convention = "numpy"
|
|
112
|
+
|
|
113
|
+
[tool.setuptools.package-data]
|
|
114
|
+
"l2co_tasks.conf" = ["**/*.yaml"]
|
|
115
|
+
|
|
116
|
+
[tool.uv]
|
|
117
|
+
package = true
|
|
118
|
+
|
|
119
|
+
[tool.uv.sources]
|
|
120
|
+
f3dasm = {editable = true, path = "../f3dasm"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""
|
|
2
|
+
L2CO Tasks - Optimization tasks compatible with the L2CO library
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Modules
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
# Local
|
|
9
|
+
from ._src.benchmark_task import (
|
|
10
|
+
CEC2019Sampler,
|
|
11
|
+
create_bbob_task,
|
|
12
|
+
create_cec2005_task,
|
|
13
|
+
)
|
|
14
|
+
from ._src.continue_from_path import retrieve_tasks
|
|
15
|
+
from ._src.euler import EulerTaskSampler, create_euler_task
|
|
16
|
+
from ._src.experimentdata import create_tasks_experimentdata
|
|
17
|
+
from ._src.gaussian_meta import create_gaussian_meta_task
|
|
18
|
+
from ._src.helmholtz import HelmholtzTaskSampler, create_helmholtz_task
|
|
19
|
+
from ._src.inviscid_burgers import (
|
|
20
|
+
InviscidBurgersTaskSampler,
|
|
21
|
+
create_inviscid_burgers_task,
|
|
22
|
+
)
|
|
23
|
+
from ._src.mnist1d_task import create_mnist1d_task
|
|
24
|
+
from ._src.pde import PDETaskSampler, create_pde_task
|
|
25
|
+
from ._src.pkpd import PKPDTaskSampler, create_pkpd_task
|
|
26
|
+
from ._src.quadratic_task import create_quadratic_task
|
|
27
|
+
from ._src.spiral_task import create_spiral_task
|
|
28
|
+
from ._src.stokes import StokesTaskSampler, create_stokes_task
|
|
29
|
+
from ._src.task import DatasetDict, Task
|
|
30
|
+
from ._src.task_gaussian_class import create_gaussian_task
|
|
31
|
+
from ._src.viscous_burgers import (
|
|
32
|
+
ViscousBurgersTaskSampler,
|
|
33
|
+
create_viscous_burgers_task,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Authorship and Credits
|
|
37
|
+
# =============================================================================
|
|
38
|
+
__author__ = "Martin van der Schelling (m.p.vanderschelling@tudelft.nl)"
|
|
39
|
+
__credits__ = ["Martin van der Schelling"]
|
|
40
|
+
__status__ = "Stable"
|
|
41
|
+
#
|
|
42
|
+
# =============================================================================
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"CEC2019Sampler",
|
|
46
|
+
"DatasetDict",
|
|
47
|
+
"EulerTaskSampler",
|
|
48
|
+
"HelmholtzTaskSampler",
|
|
49
|
+
"InviscidBurgersTaskSampler",
|
|
50
|
+
"PDETaskSampler",
|
|
51
|
+
"PKPDTaskSampler",
|
|
52
|
+
"StokesTaskSampler",
|
|
53
|
+
"Task",
|
|
54
|
+
"ViscousBurgersTaskSampler",
|
|
55
|
+
"create_bbob_task",
|
|
56
|
+
"create_cec2005_task",
|
|
57
|
+
"create_euler_task",
|
|
58
|
+
"create_gaussian_meta_task",
|
|
59
|
+
"create_gaussian_task",
|
|
60
|
+
"create_helmholtz_task",
|
|
61
|
+
"create_inviscid_burgers_task",
|
|
62
|
+
"create_mnist1d_task",
|
|
63
|
+
"create_pde_task",
|
|
64
|
+
"create_pkpd_task",
|
|
65
|
+
"create_quadratic_task",
|
|
66
|
+
"create_spiral_task",
|
|
67
|
+
"create_stokes_task",
|
|
68
|
+
"create_tasks_experimentdata",
|
|
69
|
+
"create_viscous_burgers_task",
|
|
70
|
+
"retrieve_tasks",
|
|
71
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Dataset loading and saving helpers."""
|
|
2
|
+
|
|
3
|
+
# Modules
|
|
4
|
+
# =============================================================================
|
|
5
|
+
|
|
6
|
+
# Standard
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
# Third-party
|
|
10
|
+
import jax.numpy as jnp
|
|
11
|
+
import numpy as np
|
|
12
|
+
|
|
13
|
+
# Authorship & Credits
|
|
14
|
+
# =============================================================================
|
|
15
|
+
__author__ = "Martin van der Schelling (M.P.vanderSchelling@tudelft.nl)"
|
|
16
|
+
__credits__ = ["Martin van der Schelling"]
|
|
17
|
+
__status__ = "Stable"
|
|
18
|
+
# =============================================================================
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def load_dataset(path: str | Path | None) -> dict[str, jnp.ndarray]:
|
|
22
|
+
"""Load dataset from npz file.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
path : str | Path | None
|
|
27
|
+
Path to the dataset file. If None, returns empty dict.
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
-------
|
|
31
|
+
dict[str, jnp.ndarray]
|
|
32
|
+
Loaded dataset dictionary.
|
|
33
|
+
"""
|
|
34
|
+
if path is None:
|
|
35
|
+
return {}
|
|
36
|
+
with np.load(Path(path).with_suffix(".npz")) as loaded_data:
|
|
37
|
+
return {k: jnp.asarray(loaded_data[k]) for k in loaded_data.files}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def save_dataset(dataset: dict[str, jnp.ndarray], path: str | Path) -> None:
|
|
41
|
+
"""Save a dataset of arrays to an ``.npz`` file.
|
|
42
|
+
|
|
43
|
+
Creates the parent directory if needed. The write-side twin of
|
|
44
|
+
:func:`load_dataset`; the task factories delegate here rather than
|
|
45
|
+
each carrying its own copy.
|
|
46
|
+
|
|
47
|
+
Parameters
|
|
48
|
+
----------
|
|
49
|
+
dataset : dict[str, jnp.ndarray]
|
|
50
|
+
Dictionary of arrays to persist.
|
|
51
|
+
path : str | Path
|
|
52
|
+
Destination file path.
|
|
53
|
+
"""
|
|
54
|
+
_path = Path(path)
|
|
55
|
+
_path.parent.mkdir(parents=True, exist_ok=True)
|
|
56
|
+
jnp.savez(path, **dataset)
|