Copyright (C) 2009 A. Ismael F. Vaz and L. N. Vicente
Website: http://www.norg.uminho.pt/aivaz/pswarm
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
See the accompanying lgpl.txt for details.
Parallel PSwarm (PPSwarm) implements advanced global optimization algorithms for bound- and linearly-constrained problems, using a hybrid Particle Swarm and Pattern Search approach.
Key features:
- Serial and parallel (MPI) versions
- Support for bound-only or bound+linear constraints
- Optional AMPL, Python (3.x/NumPy), and MATLAB/MEX interfaces
- Fully cross-platform (Linux and Windows)
- Fast, robust, and customizable
- Vaz, A.I.F., Vicente, L.N., "A particle swarm pattern search method for bound-constrained global optimization," Journal of Global Optimization, 39 (2007), pp. 197-219.
- Vaz, A.I.F., Vicente, L.N., "PSwarm: A hybrid solver for linearly constrained global derivative-free optimization."
- v1.6: Modern CMake build system, cross-platform static/shared/optional interfaces, Python 3 and latest MATLAB supported
- v1.5: Improved memory allocation for larger problems
- v1.4: Vectorized objective function calls; Python and R interfaces
- v1.3: Iteration print callback, new options exported to interfaces
- v1.2: Bug fixes in Python interface and Makefile
- v1.1: Linear constraints, R and Python interfaces added
- v0.1: Initial release with serial/parallel and AMPL support
- C compiler (GCC, Clang, or MSVC/Visual Studio)
- [Optional] MPI for parallel version (OpenMPI or MS MPI)
- BLAS and LAPACK libraries for linear constraints (often system-installed)
- [Optional] AMPL interface: AMPL solver library (
amplsolver.a
) - [Optional] Python 3.x with NumPy (
pip install numpy
) - [Optional] MATLAB for MEX interface
Note: All dependencies (except AMPL) are auto-detected by CMake.
- README.txt : This file
- lgpl.txt : GNU LGPL license
- pattern.c, pattern.h : Pattern search algorithm
- pswarm.c, pswarm.h : Particle swarm optimization
- pswarm_main.c, .h : Main program and interface logic
- user.c : User-supplied objective/problem definition
- cache.c, cache.h : (Optional) Caching code (disabled by default)
- mve_presolve.c : Interior point code for ellipsoid
- mve_solver.c : Maximum Volume Ellipsoid computation
- pswarm_py.c, .h : Python interface
- pswarm_r.c, .h : R/MATLAB/MEX interface
- RunPswarm.py, RunPswarm.r: Example scripts
- hs024.py, hs024.r : Hock-Schittkowski example (Python/R)
- nl/ : AMPL models (not distributed)
- include/ : Additional interface headers
- libs/ : Additional libraries (AMPL, BLAS, LAPACK)
Prerequisites:
- CMake 3.15 or newer
- Required compilers/libraries as above
Quickstart (Linux/Mac):
- Open a terminal in the project root directory.
- Create a build directory: mkdir build && cd build
- Configure for a static build (default): cmake ..
- Build the software: cmake --build .
- All executables and libraries will be in
build/bin/
andbuild/lib/
.
Enabling Optional Interfaces:
- Python interface (requires Python 3 and NumPy): cmake .. -DBUILD_PYTHON=ON
- MATLAB MEX interface (requires MATLAB): cmake .. -DBUILD_MATLAB=ON
- AMPL interface (requires AMPL solver library): cmake .. -DUSE_AMPL_SOLVER=ON [-DAMPL_SOLVER=/path/to/amplsolver.a]
- Build with shared libraries: cmake .. -DBUILD_SHARED_LIBS=ON
You may combine options, e.g.: cmake .. -DBUILD_PYTHON=ON -DBUILD_MATLAB=ON -DUSE_AMPL_SOLVER=ON
Build types:
- Release (optimized, default): cmake .. -DCMAKE_BUILD_TYPE=Release
- Debug (with debug info): cmake .. -DCMAKE_BUILD_TYPE=Debug
Clean build artifacts: cmake --build . --target distclean
Quickstart (Windows, with Visual Studio):
- Install CMake and Visual Studio.
- Open "x64 Native Tools Command Prompt for VS".
- As above, create and enter a build directory.
- Configure: cmake .. -G "Visual Studio 17 2022" -A x64
- Build: cmake --build . --config Release
- Binaries will be in
build/bin/Release
and libraries inbuild/lib/Release
.
-
Standalone (serial) version:
Edituser.c
to define your objective/problem.
Build and runpswarm_serial
(orpswarm_serial_linear
for linear constraints). -
Parallel version:
Usempirun -np <N> ./pswarm_parallel
(Seejob.pbs
for cluster usage examples.) -
AMPL interface:
Build withUSE_AMPL_SOLVER=ON
.
Run with an AMPL.nl
model:./pswarm_ampl model.nl
-
Python interface:
Build withBUILD_PYTHON=ON
.
In Python, use:
import RunPswarm -
MATLAB/MEX interface:
Build withBUILD_MATLAB=ON
.
Use the resulting.mex*
file from MATLAB or as an R shared object.
PPSwarm was developed by A. Ismael F. Vaz and L. N. Vicente. Portions of the code (MVE routines) are based on work by Y. Zhang and L. Gao.
This software is distributed under the GNU Lesser General Public License (LGPL v2.1 or later). See lgpl.txt for full details.
Contact:
- A. Ismael F. Vaz — http://www.norg.uminho.pt/aivaz
- L. N. Vicente — http://www.mat.uc.pt/~lnv
Project page: http://www.norg.uminho.pt/aivaz/pswarm