Badger is an optimization interface tailored for the Accelerator Control Room (ACR)1. It places a strong emphasis on extensibility, easily expandable through the plugin system, and flexibility, offering complete GUI, CLI, and API support.
The primary goal of Badger is to establish a user-friendly interface (GUI, CLI, and API) bridging the gap between users and the machines undergoing optimization. Users only need to define an environment for each machine or simulation, allowing Badger to take charge of tasks such as connecting the problem and optimization algorithm, implementing control logic, visualizing progress, and archiving data.
Internally, Badger leverages the Xopt optimization library to drive the optimization process. This grants users the advantage of utilizing a variety of optimization algorithms available through Xopt.
Badger boasts a range of features designed to enhance your optimization experience:
- Plugin System: Easily add your optimization problem in just a few minutes.
- Versatile Modes: Enjoy full support for three modes: GUI, CLI, and API, allowing you to use Badger according to your preferences.
- Efficient Rerun: With a single click or command, rerun optimization tasks swiftly -- ideal for daily machine operation routines.
- History Exploration: Browse through past runs effortlessly.
- Optimal Solution Navigation: Jump to or set optimal solutions.
- State Recovery: Easily recover machine states after an optimization run.
- Constraint Support: Accommodate both soft and hard constraints.
- Data Preservation: Preserve all raw data for comprehensive analysis.
- Advanced Extensions: Benefit from extensions for sophisticated optimization data analysis and visualization.
For additional details about Badger and its capabilities, please refer to Badger's online documentation.
Using conda
conda install -c conda-forge badger-opt
or pip
pip install badger-opt
Currently, Badger only officially supports Linux. Badger on MacOS and Windows could be potentially unstable.
Once Badger is installed, launch the GUI by running the following command in the terminal:
badger -g
Then following this simple GUI tutorial to run your first optimizaion in Badger within a couple of minutes!
If you use Badger for your research, please consider adding the following citation to your publications.
Zhang, Z., et al. "Badger: The missing optimizer in ACR",
in Proc. IPAC'22, Bangkok. doi:10.18429/JACoW-IPAC2022-TUPOST058
BibTex entry:
@inproceedings{Badger,
author = {Z. Zhang and M. Böse and A.L. Edelen and J.R. Garrahan and Y. Hidaka and C.E. Mayes and S.A. Miskovich and D.F. Ratner and R.J. Roussel and J. Shtalenkova and S. Tomin and G.M. Wang},
title = {{Badger: The Missing Optimizer in ACR}},
booktitle = {Proc. IPAC'22},
pages = {999--1002},
eid = {TUPOST058},
language = {english},
keywords = {interface, controls, GUI, operation, framework},
venue = {Bangkok, Thailand},
series = {International Particle Accelerator Conference},
number = {13},
publisher = {JACoW Publishing, Geneva, Switzerland},
month = {07},
year = {2022},
issn = {2673-5490},
isbn = {978-3-95450-227-1},
doi = {10.18429/JACoW-IPAC2022-TUPOST058},
url = {https://jacow.org/ipac2022/papers/tupost058.pdf},
}
Clone this repository:
git clone https://github.com/xopt-org/badger.git
Create a fresh Python environment, for example using conda:
conda env create -n badger-env python=3.12
Install Badger as editable:
conda activate badger-env
pip install -e ".[dev]"
You'll also need to install ruff
and pre-commit
to be able to
pass the linting and formatting checks:
pip install ruff pre-commit
Then install the pre-commit hooks:
pre-commit install
You can also do a run at any time to check your progress:
pre-commit run --all-files
Please check out current Badger issues here before opening a new one. Alternatively, you are welcome to shoot us an email, or join our Slack channel.
Footnotes
-
Draws limited inspiration from Ocelot the optimizer. ↩