This is the official implementation of the paper: "Automated PSO Configuration Framework via Deep Neural Networks and Function Landscape Descriptors", accepted at GECCO 2026.
This code is provided for research purposes only. If you make use of this framework or code in your own work, please cite our GECCO 2026 paper (see the Citation section below).
AD-PSO is a framework designed to automate the configuration of Particle Swarm Optimization (PSO) using Deep Learning. By leveraging Function Landscape Descriptors and a Conditional Variational Autoencoder (CVAE), AD-PSO generates optimal strategies and parameters tailored to specific optimization problems.
-
Clone the repository and navigate to the project directory:
git clone git@github.com:AngelosZou/AD-PSO.git cd AD-PSO -
(Recommended) Set up a virtual environment and install the required packages:
python -m venv venv
source venv/bin/activate # On Linux and macOS
./venv/Scripts/activate # On Windows -
Install the required packages:
python -m pip install -r requirements.txt
-
Install the AD-PSO package in editable mode:
python -m pip install -e . -
(Option - Dataset) Generate the dataset
This step is optional for the user to generate the training data set.
To use the MPI features, you need to have an MPI implementation installed on your system. Common implementations include OpenMPI and MPICH.
This project prepare a pipeline for generating the dataset, which includes generating objective functions, calculate function landscape features, and optimised PSO configurations for each function.
This pipeline is designed for CPU cluster, the rank 0 is designed as the distributor, which will not perform the calculation. That is, if the core number is small, the pipeline will waste one core calculation resources.
The pipeline can be run with the following command, where
--num_samplesis the number of samples to generate for each rank, and--trialsis the number of trials for the optimization process. Setting--num_samplesto -1 will generate samples until a kill signal is received.mpiexec -n <number_of_processes> python ./src/autopso/pipeline.py --num_samples <number_of_samples_to_generate_per_rank> --trials <number_of_trials_for_optimization> # or mpirun -n <number_of_processes> python ./src/autopso/pipeline.py --num_samples <number_of_samples_to_generate_per_rank> --trials <number_of_trials_for_optimization>
This project also provides the option to run each step of the pipeline separately, which could be more flexible for users who want to modify the code or just want to run part of the pipeline. It could also be run without MPI. The details could be found in
./docs/dataset_generation.mdfile. -
(Option - Train) Train the CVAE model
Having the dataset, you can train the deep learning model. The script uses PyTorch to train the model.
python ./src/autopso/deep/train.py
There some CLI parameters to control the training process, see main part of
src/autopso/deep/train.pyfor details. -
Example usage
The
example.pyprovides an example of how to use the AD-PSO framework to optimize a specific objective function. It demonstrates how to create an instance of the PSO framework, generating the specific components and parameters according to the optimisation target, and run the optimisation process.
The project is structured into several folders, each containing specific components of the AD-PSO framework:
The ./src/autopso/objective_function/ folder contains various objective functions. The IMetaData interface defines the metadata for each objective function, including its name, dimension, boundary, rotation, and other relevant information. The IGenerator interface defines the contract for generating objective functions, which can be implemented by various classes like OpfunuGenerator for generating functions from the opfunu library.
The ./src/autopso/feature/ folder contains various features that can be extracted from the fitness landscape of objective functions. The IFeature interface defines the contract for feature extraction. Each feature class implements the parameters method to define the parameters required for feature extraction, the parameter return a dictionary with key as parameter name and value as an iterable object, where the framework will iter the parameter and each time provide one element to the extract method. The extract method is responsible for extracting the feature from the objective function. All features are registered in the FeatureRegistry, which provides a way to access and manage all available features.
The ./src/autopso/framework/ folder contains the core code about the AD-PSO framework. The ./src/autopso/framework/framework.py defines the PSO implementation class. The ./src/autopso/framework/coder.py provides serialisation and deserialisation of AD-PSO instances, allowing to encode the configuration to numerical vector (and also decode), which is used by the following deep learning model.
The ./src/autopso/framework/components/ folder contains various PSO components that could be used to modify the behavior of the PSO algorithm. Each component is designed to adjust specific parameters or introduce new behaviors in the PSO process. The IComponent interface defines the contract for all components. The class directly inherits from BaseComponent denotes the component type, which is also the interface for a series of components that share a common behavior or functionality. Each component type has specific methods that need to be implemented for the inherited component class. The Component is the actual implementation of a specific component, which inherits from the corresponding component type class and implements the required methods. Components and Types are automatically registered in the ComponentTypes and ComponentList through the module level __init__.py file.
Although Component and Component Type both inherits from BaseComponent, they serve different purposes.
How to add new Components:
- If the component is a new component type, first inherit from
BaseComponent, implement the required methods, add a specific core function (according to the specific design, like trigger or overwrite something) to the PSO flow (including PSOFramework, Group, Particle, and so on, just at where this type affects). If some parameter is required for all the component of this tpes, add a type level class attribute_params. The framework will automatically combine the parent class parameters to the component class parameters. For the types that only accept at most one component in the PSO framework (mostly types that overwrite something), set the_combinableattribute toFalse. - The new component should inherit from all relative ComponentType class and implement the required methods, use class level
_paramsdict to determine the parameter, which use the parameter name string as key and aParameterobject as value. The framework will automatically set all the parameter names and values to the component instance attributes. One Component could inherit from multiple ComponentType classes, which means that it could have multiple behaviors or functionalities.
All parameters are defined in component class level _params dictionary, which maps parameter names to Parameter objects. Each Parameter object contains metadata about the parameter, such as its type, default value. This allows for dynamic configuration of components without hardcoding values. To set the specific parameter, just use parameter name as key to the constructor function of the component class, then the IComponent level __init_subclass__ will automatically combine the parent parameter and the IComponent leve __init__ will set the parameter value to the component instance.
Some component types are conflict, which means that this component type could only use at most one component in the PSO framework. That is, if component A and B are both component type T, where T is conflict, which means that only one of them can be used in an AD-PSO instance. The conflict is noted by the _combinable attribute in the component type class, the component implementation class should not modify the _combinable attribute.
Note that conflict happened between several components impl under a conflict component type, not between different component types.
The ./src/autopso/optimise/ folder deals with the configuration process. It retrieves benchmarks from the database, generates an AD-PSO configuration, and then uses an independent optimiser (currently Optuna) to optimize this configuration. The best configuration is saved to a database.
The ./src/autopso/deep folder contains the deep learning model that maps the features of the objective functions to the optimal PSO configurations. The model is trained using the landscape features extracted from the objective functions and the optimal configurations obtained from the optimiser. The ./src/autopso/deep/train.py file contains the training script, which uses PyTorch to train the model. The main part of train.py defines several command line arguments to control the training process.
If you use this code or framework in your research, please cite our paper:
Plain Text:
Yutong Zou and Peter Bentley. 2026. Automated PSO Configuration Framework via Deep Neural Networks and Function Landscape Descriptors. In Genetic and Evolutionary Computation Conference (GECCO ’26), July 13–17, 2026, San Jose, Costa Rica. ACM, New York, NY, USA. https://doi.org/10.1145/3795095.3805049
BibTeX:
@inproceedings{Zou2026ADPSO,
author = {Zou, Yutong and Bentley, Peter},
title = {Automated PSO Configuration Framework via Deep Neural Networks and Function Landscape Descriptors},
booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference (GECCO '26)},
year = {2026},
isbn = {979-8-4007-2487-9/2026/07},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
location = {San Jose, Costa Rica},
doi = {10.1145/3795095.3805049}
}