globalsearch-rs: Rust implementation of a modified version of the OQNLP (OptQuest/NLP) algorithm with the core ideas from "Scatter Search and Local NLP Solvers: A Multistart Framework for Global Optimization" by Ugray et al. (2007). It combines scatter search metaheuristics with local minimization for global optimization of nonlinear problems.
Similar to MATLAB's GlobalSearch [2], using cobyla, argmin, rayon and ndarray.
Features
-
π Python Bindings
-
π― Multistart heuristic framework for global optimization
-
π¦ Local optimization using the cobyla [3] and argmin crate [4]
-
π Parallel execution using Rayon
-
π Checkpointing support for long-running optimizations
Installation
Using as a dependency
Add this to your Cargo.toml:
[]
= "0.5.0"
Or use cargo add globalsearch in your project directory.
Building from source
-
Install Rust toolchain using rustup.
-
Clone repository:
-
Build the project:
Usage
-
Define a problem by implementing the
Problemtrait.use ; use Problem; use EvaluationError; ;The
constraintsmethod (only available with the COBYLA local solver) allows you to define constraint functions for constrained optimization problems. Constraints should follow the sign convention:- Positive or zero: constraint satisfied
- Negative: constraint violated
Example:
Depending on your choice of local solver, you might need to implement the
gradientandhessianmethods. Learn more about the local solver configuration in the argmin docs or theLocalSolverType.π΄ Note: If using a solver that isn't COBYLA, variable bounds are only used in the scatter search phase of the algorithm. The local solver is unconstrained (See argmin issue #137) and therefor can return solutions out of bounds. You can use OQNLP's
exclude_out_of_boundsmethod to handle this if needed. -
Set OQNLP parameters
use ; use SteepestDescentBuilder; let params: OQNLPParams = OQNLPParams ;Or use the default parameters (which use COBYLA):
let params = default;Where
OQNLPParamsis defined as:And
LocalSolverTypeis defined as:You can also modify the local solver configuration for each type of local solver. See
builders.rsfor more details. -
Run the optimizer
use ; use
Project Structure
src/
βββ lib.rs # Module declarations
βββ oqnlp.rs # Core OQNLP algorithm implementation
βββ scatter_search.rs # Scatter search component
βββ local_solver/
β βββ builders.rs # Local solver configuration builders
β βββ runner.rs # Local solver runner
βββ filters.rs # Merit and distance filtering logic
βββ problem.rs # Problem trait
βββ types.rs # Data structures and parameters
βββ checkpoint.rs # Checkpointing module
python/ # Python bindings
Dependencies
- ndarray
- COBYLA
- argmin [feature:
argmin] - rayon [feature:
rayon] - kdam [feature:
progress_bar] - rand
- thiserror
- criterion.rs [dev-dependency]
- serde [feature:
checkpointing] - chrono [feature:
checkpointing] - bincode [feature:
checkpointing]
License
Distributed under the MIT License. See LICENSE.txt for more information.
Citing Globalsearch-rs
If GlobalSearch-rs has been significant in your research, and you would like to acknowledge the project in your academic publication, we suggest citing the following paper:
References
[1] Zsolt Ugray, Leon Lasdon, John Plummer, Fred Glover, James Kelly, Rafael MartΓ, (2007) Scatter Search and Local NLP Solvers: A Multistart Framework for Global Optimization. INFORMS Journal on Computing 19(3):328-340. http://dx.doi.org/10.1287/ijoc.1060.0175
[2] GlobalSearch. The MathWorks, Inc. Available at: https://www.mathworks.com/help/gads/globalsearch.html (Accessed: 27 January 2025)
[3] RΓ©mi Lafage. cobyla - a pure Rust implementation. GitHub repository. MIT License. Available at: https://github.com/relf/cobyla (Accessed: 17 September 2025)
[4] Kroboth, S. argmin{}. Available at: https://argmin-rs.org/ (Accessed: 25 January 2025)