tunecontrol 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.
Files changed (41) hide show
  1. tunecontrol-0.1.0/CITATION.cff +34 -0
  2. tunecontrol-0.1.0/LICENCE.txt +21 -0
  3. tunecontrol-0.1.0/MANIFEST.in +3 -0
  4. tunecontrol-0.1.0/PKG-INFO +175 -0
  5. tunecontrol-0.1.0/README.md +146 -0
  6. tunecontrol-0.1.0/examples/standard_bo_for_controller_tuning.ipynb +275 -0
  7. tunecontrol-0.1.0/pyproject.toml +50 -0
  8. tunecontrol-0.1.0/setup.cfg +4 -0
  9. tunecontrol-0.1.0/tests/test_bo_example.py +41 -0
  10. tunecontrol-0.1.0/tests/test_cartpole_itae.py +44 -0
  11. tunecontrol-0.1.0/tests/test_distribution.py +33 -0
  12. tunecontrol-0.1.0/tests/test_evaluation.py +127 -0
  13. tunecontrol-0.1.0/tests/test_randomness.py +88 -0
  14. tunecontrol-0.1.0/tests/test_registry.py +119 -0
  15. tunecontrol-0.1.0/tests/test_tank_costs.py +84 -0
  16. tunecontrol-0.1.0/tests/test_tank_overshoot.py +44 -0
  17. tunecontrol-0.1.0/tests/test_tank_rise_time.py +60 -0
  18. tunecontrol-0.1.0/tests/test_trajectory.py +41 -0
  19. tunecontrol-0.1.0/tunecontrol/__init__.py +25 -0
  20. tunecontrol-0.1.0/tunecontrol/random.py +9 -0
  21. tunecontrol-0.1.0/tunecontrol/registry.py +104 -0
  22. tunecontrol-0.1.0/tunecontrol/tasks/__init__.py +4 -0
  23. tunecontrol-0.1.0/tunecontrol/tasks/base.py +131 -0
  24. tunecontrol-0.1.0/tunecontrol/tasks/cartpole/__init__.py +25 -0
  25. tunecontrol-0.1.0/tunecontrol/tasks/cartpole/config.py +35 -0
  26. tunecontrol-0.1.0/tunecontrol/tasks/cartpole/objectives.py +94 -0
  27. tunecontrol-0.1.0/tunecontrol/tasks/cartpole/plant.py +231 -0
  28. tunecontrol-0.1.0/tunecontrol/tasks/cartpole/task.py +67 -0
  29. tunecontrol-0.1.0/tunecontrol/tasks/cartpole/visualization.py +60 -0
  30. tunecontrol-0.1.0/tunecontrol/tasks/cascaded_tank/__init__.py +25 -0
  31. tunecontrol-0.1.0/tunecontrol/tasks/cascaded_tank/config.py +65 -0
  32. tunecontrol-0.1.0/tunecontrol/tasks/cascaded_tank/objectives.py +125 -0
  33. tunecontrol-0.1.0/tunecontrol/tasks/cascaded_tank/plant.py +173 -0
  34. tunecontrol-0.1.0/tunecontrol/tasks/cascaded_tank/task.py +66 -0
  35. tunecontrol-0.1.0/tunecontrol/tasks/cascaded_tank/visualization.py +48 -0
  36. tunecontrol-0.1.0/tunecontrol/tasks/module_utils.py +91 -0
  37. tunecontrol-0.1.0/tunecontrol.egg-info/PKG-INFO +175 -0
  38. tunecontrol-0.1.0/tunecontrol.egg-info/SOURCES.txt +57 -0
  39. tunecontrol-0.1.0/tunecontrol.egg-info/dependency_links.txt +1 -0
  40. tunecontrol-0.1.0/tunecontrol.egg-info/requires.txt +11 -0
  41. tunecontrol-0.1.0/tunecontrol.egg-info/top_level.txt +1 -0
@@ -0,0 +1,34 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use TuneControl in your research, please cite the paper below."
3
+ title: TuneControl
4
+ type: software
5
+ version: 0.1.0
6
+ license: MIT
7
+ repository-code: "https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol"
8
+ authors:
9
+ - family-names: von Rohr
10
+ given-names: Alexander
11
+ - family-names: Menn
12
+ given-names: Johanna
13
+ - family-names: Brunzema
14
+ given-names: Paul
15
+ preferred-citation:
16
+ type: article
17
+ title: "A Decade of Bayesian Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects"
18
+ authors:
19
+ - family-names: Stenger
20
+ given-names: David
21
+ - family-names: Brunzema
22
+ given-names: Paul
23
+ - family-names: Menn
24
+ given-names: Johanna
25
+ - family-names: von Rohr
26
+ given-names: Alexander
27
+ - family-names: Schoellig
28
+ given-names: Angela P.
29
+ - family-names: Trimpe
30
+ given-names: Sebastian
31
+ year: 2026
32
+ journal: arXiv
33
+ doi: "10.48550/arXiv.2609.09403"
34
+ url: "https://arxiv.org/abs/2609.09403"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Alexander von Rohr, Johanna Menn, Paul Brunzema
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include CITATION.cff
2
+ recursive-include tests *.py
3
+ include examples/standard_bo_for_controller_tuning.ipynb
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: tunecontrol
3
+ Version: 0.1.0
4
+ Summary: A benchmark suite for controller tuning.
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol
7
+ Project-URL: Issues, https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol/issues
8
+ Project-URL: Documentation, https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol/blob/main/README.md
9
+ Project-URL: Paper, https://arxiv.org/abs/2609.09403
10
+ Keywords: controller tuning,bayesian optimization,benchmark,robotics
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Requires-Python: <3.13,>=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENCE.txt
19
+ Requires-Dist: numpy>=1.26
20
+ Requires-Dist: scipy>=1.11
21
+ Requires-Dist: matplotlib
22
+ Requires-Dist: torch>=2.2
23
+ Provides-Extra: botorch
24
+ Requires-Dist: botorch==0.15.1; extra == "botorch"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Requires-Dist: ruff; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # TuneControl
31
+
32
+ A collection of **black-box controller-tuning problems** with a common
33
+ Python interface. Choose a problem and objective, supply controller gains, and
34
+ receive a scalar cost plus the simulated trajectory.
35
+
36
+ The collection currently includes CartPole and cascaded tanks, each with several
37
+ objectives and deterministic or noisy configurations. You can use the problems
38
+ with your own optimizer or add a new problem family.
39
+
40
+ ![Controller tuning workflow: gains → controller → simulator → cost](docs/bo_example.png)
41
+
42
+ ## Install
43
+
44
+ TuneControl currently supports **Python 3.12**. Install from GitHub:
45
+
46
+ ```bash
47
+ python -m pip install "tunecontrol @ git+https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol.git"
48
+ ```
49
+
50
+ For the Bayesian optimization notebook, include BoTorch:
51
+
52
+ ```bash
53
+ python -m pip install "tunecontrol[botorch] @ git+https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol.git"
54
+ ```
55
+
56
+ For development from a local checkout, run `python -m pip install -e '.[dev,botorch]'`.
57
+
58
+ ## Evaluate a controller
59
+
60
+ ```python
61
+ from tunecontrol import CartPole, CartPoleConfig
62
+
63
+ problem = CartPole(CartPoleConfig(dim=2, objective="mae"))
64
+ theta = problem.bounds.mean(dim=0)
65
+ value, info = problem.evaluate(theta)
66
+
67
+ print(f"Cost: {value.item():.4f}")
68
+ print("Controller:", theta.tolist())
69
+ print("State columns:", info["trajectory"]["state_names"])
70
+ ```
71
+
72
+ Expected output:
73
+
74
+ ```text
75
+ Cost: 8.2734
76
+ Controller: [-40.0, -6.25]
77
+ State columns: ('cart_position', 'cart_velocity', 'pole_angle', 'pole_angular_velocity')
78
+ ```
79
+
80
+ The bounds describe the controller search space; their midpoint is an example
81
+ controller. `info["trajectory"]` contains timestamps, state and input arrays,
82
+ and column names and units. See [evaluate and plot](examples/quickstart.py) to
83
+ visualize both built-in problems.
84
+
85
+ ## Problems
86
+
87
+ | Family | Controller parameters | Objectives | Standard configurations |
88
+ |---|---|---|---|
89
+ | [CartPole](docs/cartpole_task_doc.md) | 1–4 state-feedback gains | MAE, LQR, ITAE | 24 |
90
+ | [Cascaded tanks](docs/cascaded_tank_task_doc.md) | 2 PI gains | SSE, LogSSE, quadratic, rise time, overshoot | 10 |
91
+
92
+ Both families provide deterministic and noisy configurations. Standard
93
+ configurations enumerate combinations of dimensions, objectives, and noise;
94
+ custom settings are also supported. The linked problem descriptions define the
95
+ models, objectives, bounds, and sampling conventions.
96
+
97
+ ```python
98
+ import tunecontrol as tc
99
+
100
+ print(tc.list_problems()) # ['cartpole', 'cascaded_tank']
101
+ configs = tc.available_configs("cartpole")
102
+ problem = tc.make("cartpole", config={"dim": 2, "objective": "mae"})
103
+ ```
104
+
105
+ Direct Python construction and registry construction use the same configurations.
106
+ See [discover and configure](examples/discover_problems.py) for configuration
107
+ serialization and reconstruction.
108
+
109
+ ![Objective landscapes for deterministic two-parameter problems](docs/figures/deterministic_2d_gallery.png)
110
+
111
+ Darker colors indicate lower cost. White regions mark undefined evaluations.
112
+
113
+ ## Noise and evaluation behavior
114
+
115
+ Configurations are deterministic by default (`noise=None`). To add process noise
116
+ and CartPole initial-state perturbations, supply a noise configuration:
117
+
118
+ ```python
119
+ from tunecontrol import CartPole, CartPoleConfig, CartPoleNoise
120
+
121
+ problem = CartPole(CartPoleConfig(dim=2, noise=CartPoleNoise()))
122
+ problem.setup(run_seed=42)
123
+ value, info = problem.evaluate(problem.bounds.mean(dim=0))
124
+ ```
125
+
126
+ Each problem owns its random stream. Successive noisy evaluations advance that
127
+ stream; calling `setup(run_seed=42)` again replays the sequence. Record the family,
128
+ full configuration, package version, and seed when saving an experiment. Seeded
129
+ replay assumes the same software and runtime environment.
130
+
131
+ `evaluate` accepts a finite floating-point tensor of shape `(problem.dim,)`.
132
+ Gains must lie within the declared bounds, including the endpoints. Out-of-bounds
133
+ gains raise `ValueError` before simulation. Other invalid inputs also raise errors.
134
+ Undefined or nonfinite objectives return `(NaN, info)` with diagnostics preserved.
135
+ Check `torch.isnan(value)` before using a cost in an optimizer. Penalty handling
136
+ belongs to the optimizer or example, rather than the problem itself.
137
+
138
+ ## Examples
139
+
140
+ Start with [the example guide](examples/README.md). Notebooks include saved outputs
141
+ and plots so you can read them directly on GitHub.
142
+
143
+ | Example | Purpose |
144
+ |---|---|
145
+ | [Evaluate and plot](examples/quickstart.py) | Run both built-in problems and inspect trajectories |
146
+ | [Discover and configure](examples/discover_problems.py) | List families and save a configuration |
147
+ | [Bayesian optimization](examples/standard_bo_for_controller_tuning.ipynb) | Tune one controller gain with BoTorch |
148
+ | [Add a problem](examples/creating_custom_task.ipynb) | Implement a mass-spring-damper family |
149
+
150
+ ## Contributing
151
+
152
+ New controller-tuning problems are welcome. Start with the
153
+ [custom-task notebook](examples/creating_custom_task.ipynb) and the
154
+ [family API and contribution guide](docs/task_module_architecture.md).
155
+ Document the model, controller parameters, objective definitions, noise, and
156
+ sampling, and include tests and an example trajectory with your contribution.
157
+
158
+ ## Citation
159
+ TuneControl was introduced in [*A Decade of Bayesian Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects*](https://arxiv.org/abs/2609.09403). Please cite it if TuneControl supports your research.
160
+
161
+ ```bibtex
162
+ @misc{stenger2026decade,
163
+ title = {A Decade of {Bayesian} Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects},
164
+ author = {Stenger, David and Brunzema, Paul and Menn, Johanna and von Rohr, Alexander and Schoellig, Angela P. and Trimpe, Sebastian},
165
+ year = {2026},
166
+ eprint = {2609.09403},
167
+ archivePrefix = {arXiv},
168
+ primaryClass = {cs.RO},
169
+ doi = {10.48550/arXiv.2609.09403},
170
+ url = {https://arxiv.org/abs/2609.09403}
171
+ }
172
+ ```
173
+
174
+ ## License
175
+ Released under the [MIT License](LICENCE.txt).
@@ -0,0 +1,146 @@
1
+ # TuneControl
2
+
3
+ A collection of **black-box controller-tuning problems** with a common
4
+ Python interface. Choose a problem and objective, supply controller gains, and
5
+ receive a scalar cost plus the simulated trajectory.
6
+
7
+ The collection currently includes CartPole and cascaded tanks, each with several
8
+ objectives and deterministic or noisy configurations. You can use the problems
9
+ with your own optimizer or add a new problem family.
10
+
11
+ ![Controller tuning workflow: gains → controller → simulator → cost](docs/bo_example.png)
12
+
13
+ ## Install
14
+
15
+ TuneControl currently supports **Python 3.12**. Install from GitHub:
16
+
17
+ ```bash
18
+ python -m pip install "tunecontrol @ git+https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol.git"
19
+ ```
20
+
21
+ For the Bayesian optimization notebook, include BoTorch:
22
+
23
+ ```bash
24
+ python -m pip install "tunecontrol[botorch] @ git+https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol.git"
25
+ ```
26
+
27
+ For development from a local checkout, run `python -m pip install -e '.[dev,botorch]'`.
28
+
29
+ ## Evaluate a controller
30
+
31
+ ```python
32
+ from tunecontrol import CartPole, CartPoleConfig
33
+
34
+ problem = CartPole(CartPoleConfig(dim=2, objective="mae"))
35
+ theta = problem.bounds.mean(dim=0)
36
+ value, info = problem.evaluate(theta)
37
+
38
+ print(f"Cost: {value.item():.4f}")
39
+ print("Controller:", theta.tolist())
40
+ print("State columns:", info["trajectory"]["state_names"])
41
+ ```
42
+
43
+ Expected output:
44
+
45
+ ```text
46
+ Cost: 8.2734
47
+ Controller: [-40.0, -6.25]
48
+ State columns: ('cart_position', 'cart_velocity', 'pole_angle', 'pole_angular_velocity')
49
+ ```
50
+
51
+ The bounds describe the controller search space; their midpoint is an example
52
+ controller. `info["trajectory"]` contains timestamps, state and input arrays,
53
+ and column names and units. See [evaluate and plot](examples/quickstart.py) to
54
+ visualize both built-in problems.
55
+
56
+ ## Problems
57
+
58
+ | Family | Controller parameters | Objectives | Standard configurations |
59
+ |---|---|---|---|
60
+ | [CartPole](docs/cartpole_task_doc.md) | 1–4 state-feedback gains | MAE, LQR, ITAE | 24 |
61
+ | [Cascaded tanks](docs/cascaded_tank_task_doc.md) | 2 PI gains | SSE, LogSSE, quadratic, rise time, overshoot | 10 |
62
+
63
+ Both families provide deterministic and noisy configurations. Standard
64
+ configurations enumerate combinations of dimensions, objectives, and noise;
65
+ custom settings are also supported. The linked problem descriptions define the
66
+ models, objectives, bounds, and sampling conventions.
67
+
68
+ ```python
69
+ import tunecontrol as tc
70
+
71
+ print(tc.list_problems()) # ['cartpole', 'cascaded_tank']
72
+ configs = tc.available_configs("cartpole")
73
+ problem = tc.make("cartpole", config={"dim": 2, "objective": "mae"})
74
+ ```
75
+
76
+ Direct Python construction and registry construction use the same configurations.
77
+ See [discover and configure](examples/discover_problems.py) for configuration
78
+ serialization and reconstruction.
79
+
80
+ ![Objective landscapes for deterministic two-parameter problems](docs/figures/deterministic_2d_gallery.png)
81
+
82
+ Darker colors indicate lower cost. White regions mark undefined evaluations.
83
+
84
+ ## Noise and evaluation behavior
85
+
86
+ Configurations are deterministic by default (`noise=None`). To add process noise
87
+ and CartPole initial-state perturbations, supply a noise configuration:
88
+
89
+ ```python
90
+ from tunecontrol import CartPole, CartPoleConfig, CartPoleNoise
91
+
92
+ problem = CartPole(CartPoleConfig(dim=2, noise=CartPoleNoise()))
93
+ problem.setup(run_seed=42)
94
+ value, info = problem.evaluate(problem.bounds.mean(dim=0))
95
+ ```
96
+
97
+ Each problem owns its random stream. Successive noisy evaluations advance that
98
+ stream; calling `setup(run_seed=42)` again replays the sequence. Record the family,
99
+ full configuration, package version, and seed when saving an experiment. Seeded
100
+ replay assumes the same software and runtime environment.
101
+
102
+ `evaluate` accepts a finite floating-point tensor of shape `(problem.dim,)`.
103
+ Gains must lie within the declared bounds, including the endpoints. Out-of-bounds
104
+ gains raise `ValueError` before simulation. Other invalid inputs also raise errors.
105
+ Undefined or nonfinite objectives return `(NaN, info)` with diagnostics preserved.
106
+ Check `torch.isnan(value)` before using a cost in an optimizer. Penalty handling
107
+ belongs to the optimizer or example, rather than the problem itself.
108
+
109
+ ## Examples
110
+
111
+ Start with [the example guide](examples/README.md). Notebooks include saved outputs
112
+ and plots so you can read them directly on GitHub.
113
+
114
+ | Example | Purpose |
115
+ |---|---|
116
+ | [Evaluate and plot](examples/quickstart.py) | Run both built-in problems and inspect trajectories |
117
+ | [Discover and configure](examples/discover_problems.py) | List families and save a configuration |
118
+ | [Bayesian optimization](examples/standard_bo_for_controller_tuning.ipynb) | Tune one controller gain with BoTorch |
119
+ | [Add a problem](examples/creating_custom_task.ipynb) | Implement a mass-spring-damper family |
120
+
121
+ ## Contributing
122
+
123
+ New controller-tuning problems are welcome. Start with the
124
+ [custom-task notebook](examples/creating_custom_task.ipynb) and the
125
+ [family API and contribution guide](docs/task_module_architecture.md).
126
+ Document the model, controller parameters, objective definitions, noise, and
127
+ sampling, and include tests and an example trajectory with your contribution.
128
+
129
+ ## Citation
130
+ TuneControl was introduced in [*A Decade of Bayesian Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects*](https://arxiv.org/abs/2609.09403). Please cite it if TuneControl supports your research.
131
+
132
+ ```bibtex
133
+ @misc{stenger2026decade,
134
+ title = {A Decade of {Bayesian} Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects},
135
+ author = {Stenger, David and Brunzema, Paul and Menn, Johanna and von Rohr, Alexander and Schoellig, Angela P. and Trimpe, Sebastian},
136
+ year = {2026},
137
+ eprint = {2609.09403},
138
+ archivePrefix = {arXiv},
139
+ primaryClass = {cs.RO},
140
+ doi = {10.48550/arXiv.2609.09403},
141
+ url = {https://arxiv.org/abs/2609.09403}
142
+ }
143
+ ```
144
+
145
+ ## License
146
+ Released under the [MIT License](LICENCE.txt).