This repository provides implementation for SNBO (Scalable Neural Network-based Blackbox Optimization) — a novel method for efficient blackbox optimization using neural networks. It also includes code for benchmark algorithms and a suite of test problems used in the paper.
📝 Note: This work is currently under review but a preprint version is available at: https://arxiv.org/abs/2508.03827
This repository includes implementation for the following optimization algorithms:
SNBO: Scalable neural network-based blackbox optimization (proposed method)BO+LogEI: Bayesian optimization with LogEI acquisitionIBNN: Bayesian optimization with IBNN kernel and LogEI acquisitionTuRBO: Trust region Bayesian optimizationDYCORS: Dynamic coordinate search with repsonse surface model
This repository also contains following test problems:
- Ackley function
- Rastrigin function
- Levy function
- Rover trajectory optimization
- Half-Cheetah problem
- Wing shape optimization
Before running any example, you need to set up the environment and install the dependencies.
conda create -n "snbo" python=3.12
conda activate snbo
Install the required Python packages using pip:
pip install numpy==2.3.1 scipy==1.16.0 matplotlib==3.10.3 torch==2.7.1
gpytorch==1.14 botorch==0.14.0 gymnasium["mujoco"]==1.2.0
If you want to use DYCORS, then please install it using following commands:
git clone https://github.com/aquirosr/DyCors
cd DyCors
pip install .
To run the wing shape optimization problem, additional packages need to be installed. Following is a list of required packages for the wing problem:
| Package | Version | Description |
|---|---|---|
| ADflow | 2.11.0 | CFD solver for solving the flow around the wing, and compute drag and lift coefficients |
| pyGeo | 1.17.0 | parametrizing the wing shape using FFD method and compute wing volume |
| IDWarp | 2.6.2 | used for manipulating the CFD mesh based on wing shape changes |
| blackbox | 0.9.0 | provides a standard interface for evaluating the wing problem |
📥 Important: Before running any example, download the latest released or tagged version of this repository from the releases page.
The main file for running experiments is optimize.py, found in algorithms folder. This file provides following arguments:
| Argument | Type | Description |
|---|---|---|
method |
str | Optimization method: "bo", "ibnn", "turbo", "dycors", "snbo" |
problem |
str | Test problem: "ackley", "rastrigin", "levy", "rover", "halfcheetah", "wing" |
dim |
int | Dimensionality of the problem |
n_init |
int | Number of initial samples |
max_evals |
int | Maximum number of function evaluations |
neurons |
list | Neurons per layer (only for snbo) |
act_funcs |
list | Activation functions per layer (only for snbo) |
seed |
int | Random seed (optional) |
There are two ways to run this file:
✅ Option 1: You can directly run the file from the terminal. For example, to solve the rover problem using SNBO method, you can use following command:
python algorithms/optimize.py --method "snbo" --problem "rover" --dim 100 --n_init 200 --max_evals 2000 --neurons 256 256 --act_funcs "GELU" "GELU"
⚠️ NOTE: Before running the file, you need to append the path of the root folder toPYTHONPATHvariable. This can be done by running following command in the terminal before running the python file:export PYTHONPATH=PATH_TO_SNBO_FOLDER:$PYTHONPATHOr, you can add this line to your shell configuration file (
.bashrcor.zshrc) and reload the terminal.
✅ Option 2 (Recommended): Instead of directly running the optimize.py file, you can use one of the ready-to-use scripts available in runscript folder. These scripts already include the export statement requried for appending the PYTHONPATH variable at the start of the script, you just need to ensure that correct path is defined.
To solve a test problem using SNBO or any of the benchmark methods, you can use single_run.sh file under runscripts folder. To execute the file, run:
bash runscripts/single_run.sh
If you want to run a batch of optimization, you can use batch_run.sh file under runscripts folder. To execute the file, run:
bash runscripts/batch_run.sh
⚠️ NOTE: It is recommended to run the python or the bash file from the root folder and NOT from within the subfolder.
When you run the optimize.py file or any of the bash script, a folder named results will be created that consists of
different subfolders, depending on the problem you are solving and the method you selected. A mat file will be saved within appropriate
subfoler that contains entire optimization history.
To reproduce the data reported in the paper, various scripts have been provided in the runscripts/paper_results folder. Refer to the scripts for more details. Following command can be used for running a problem:
bash runscripts/paper_results/ackley.sh
⏳ Warning: This script will might a long time to run, depending on the runs and resources used.
If you use SNBO method in your research, please cite the original work (citation coming soon, paper under review).