Skip to main content

TuneControl

A collection of black-box controller-tuning problems with a common Python interface. Choose a problem and objective, supply controller gains, and receive a scalar cost plus the simulated trajectory.

The collection currently includes CartPole and cascaded tanks, each with several objectives and deterministic or noisy configurations. You can use the problems with your own optimizer or add a new problem family.

Controller tuning workflow: gains → controller → simulator → cost

Install

TuneControl currently supports Python 3.12. Install from GitHub:

python -m pip install "tunecontrol @ git+https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol.git"

For the Bayesian optimization notebook, include BoTorch:

python -m pip install "tunecontrol[botorch] @ git+https://github.com/Data-Science-in-Mechanical-Engineering/tunecontrol.git"

For development from a local checkout, run python -m pip install -e '.[dev,botorch]'.

Evaluate a controller

from tunecontrol import CartPole, CartPoleConfig

problem = CartPole(CartPoleConfig(dim=2, objective="mae"))
theta = problem.bounds.mean(dim=0)
value, info = problem.evaluate(theta)

print(f"Cost: {value.item():.4f}")
print("Controller:", theta.tolist())
print("State columns:", info["trajectory"]["state_names"])

Expected output:

Cost: 8.2734
Controller: [-40.0, -6.25]
State columns: ('cart_position', 'cart_velocity', 'pole_angle', 'pole_angular_velocity')

The bounds describe the controller search space; their midpoint is an example controller. info["trajectory"] contains timestamps, state and input arrays, and column names and units. See evaluate and plot to visualize both built-in problems.

Problems

Family Controller parameters Objectives Standard configurations
CartPole 1–4 state-feedback gains MAE, LQR, ITAE 24
Cascaded tanks 2 PI gains SSE, LogSSE, quadratic, rise time, overshoot 10

Both families provide deterministic and noisy configurations. Standard configurations enumerate combinations of dimensions, objectives, and noise; custom settings are also supported. The linked problem descriptions define the models, objectives, bounds, and sampling conventions.

import tunecontrol as tc

print(tc.list_problems())  # ['cartpole', 'cascaded_tank']
configs = tc.available_configs("cartpole")
problem = tc.make("cartpole", config={"dim": 2, "objective": "mae"})

Direct Python construction and registry construction use the same configurations. See discover and configure for configuration serialization and reconstruction.

Objective landscapes for deterministic two-parameter problems

Darker colors indicate lower cost. White regions mark undefined evaluations.

Noise and evaluation behavior

Configurations are deterministic by default (noise=None). To add process noise and CartPole initial-state perturbations, supply a noise configuration:

from tunecontrol import CartPole, CartPoleConfig, CartPoleNoise

problem = CartPole(CartPoleConfig(dim=2, noise=CartPoleNoise()))
problem.setup(run_seed=42)
value, info = problem.evaluate(problem.bounds.mean(dim=0))

Each problem owns its random stream. Successive noisy evaluations advance that stream; calling setup(run_seed=42) again replays the sequence. Record the family, full configuration, package version, and seed when saving an experiment. Seeded replay assumes the same software and runtime environment.

evaluate accepts a finite floating-point tensor of shape (problem.dim,). Gains must lie within the declared bounds, including the endpoints. Out-of-bounds gains raise ValueError before simulation. Other invalid inputs also raise errors. Undefined or nonfinite objectives return (NaN, info) with diagnostics preserved. Check torch.isnan(value) before using a cost in an optimizer. Penalty handling belongs to the optimizer or example, rather than the problem itself.

Examples

Start with the example guide. Notebooks include saved outputs and plots so you can read them directly on GitHub.

Example Purpose
Evaluate and plot Run both built-in problems and inspect trajectories
Discover and configure List families and save a configuration
Bayesian optimization Tune one controller gain with BoTorch
Add a problem Implement a mass-spring-damper family

Contributing

New controller-tuning problems are welcome. Start with the custom-task notebook and the family API and contribution guide. Document the model, controller parameters, objective definitions, noise, and sampling, and include tests and an example trajectory with your contribution.

Citation

TuneControl was introduced in A Decade of Bayesian Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects. Please cite it if TuneControl supports your research.

@misc{stenger2026decade,
    title = {A Decade of {Bayesian} Optimization for Controller Tuning and Robot Learning: Tutorial, Review, and Future Prospects},
    author = {Stenger, David and Brunzema, Paul and Menn, Johanna and von Rohr, Alexander and Schoellig, Angela P. and Trimpe, Sebastian},
    year = {2026},
    eprint = {2609.09403},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    doi = {10.48550/arXiv.2609.09403},
    url = {https://arxiv.org/abs/2609.09403}
}

License

Released under the MIT License.

Metadata

Release files for tunecontrol 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tunecontrol 0.1.0
File Size Uploaded Provenance Actions
tunecontrol-0.1.0.tar.gz 73.8 kB With provenance Details for tunecontrol-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tunecontrol 0.1.0
File Interpreter ABI Platform Actions
tunecontrol-0.1.0-py3-none-any.whl Python 3 none any Details for tunecontrol-0.1.0-py3-none-any.whl

Total release size: 98.4 kB

Release files / tunecontrol-0.1.0.tar.gz

Download URL tunecontrol-0.1.0.tar.gz
Size 73.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b1529326ce07e8bb8bb0eb9a436847b4aec8a34e20a026877530a656e34d3b87
BLAKE2b-256 checksum
How to use checksums
d192570060a0447622368aa0c442dda237420ca725ca5a3c0d562411db2e2abe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release files / tunecontrol-0.1.0-py3-none-any.whl

Download URL tunecontrol-0.1.0-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac2a5965004bf1c7e7b8e890b414fe0f188d8c3800b3981c37aa9cbc2d79b142
BLAKE2b-256 checksum
How to use checksums
0d858c1c6abe5a266ae996f5e56a76123436fe84fb5d5495430187cda004e7d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Security for tunecontrol 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tunecontrol-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page