l_srtde
A Rust implementation of the L-SRTDE (Large Scale Random Topology Differential Evolution) algorithm for large-scale numerical optimization.
This crate focuses on large-scale global optimization problems and uses rayon
to parallelize population evaluation.
Reference
This crate implements the algorithm proposed by V. Stanovov and E. Semenkin. If you use the algorithm or this code in research, cite the original paper:
V. Stanovov and E. Semenkin, "Success Rate-based Adaptive Differential Evolution L-SRTDE for CEC 2024 Competition," 2024 IEEE Congress on Evolutionary Computation (CEC), Yokohama, Japan, 2024, pp. 1-8, doi: 10.1109/CEC60901.2024.10611907.
Features
- Parallel population evaluation with
rayon - Success-rate based adaptation of the scaling factor
F - Linear population size reduction (LPSR)
- Random-topology strategy for large search spaces
- Pure Rust implementation
- C ABI dynamic library for non-Rust callers
Installation
[]
= "0.1.3"
Quick Start
use ;
Advanced Configuration
let solver = new
.with_max_evaluations
.with_pop_size_multiplier
.with_memory_size
.with_seed;
You can also use a callback to monitor progress or stop the search early:
let mut generation = 0;
let solution = solver.run_with_callback?;
C ABI / Dynamic Library
The crate can also be built as a dynamic library for C, C++, Python ctypes,
and other languages that can load a C ABI library.
Build the release library:
The dynamic library is written to target/release:
- Windows:
l_srtde.dll - Linux:
libl_srtde.so - macOS:
libl_srtde.dylib
Use include/l_srtde.h from C:
static int32_t
The callback receives a row-major batch of point_count * dim doubles and must
write point_count fitness values. Return 0 on success and a non-zero value
to stop the optimization with LSRTDE_CALLBACK_ERROR.
Example link commands:
# Linux/macOS
# Windows MSVC
Minimal Python ctypes loading:
= # use ./libl_srtde.so or ./libl_srtde.dylib on Unix
=
=
= 0.0
=
+= *
=
return 0
When a C ABI config field is set to zero, max_evaluations, memory_size, and
pop_size_multiplier use the Rust defaults. Set use_seed to 0 for a random
seed or non-zero to use seed.
Validation And Budget Semantics
run() and run_with_callback() now return Result<_, LsrtdeError>. The
solver rejects invalid configurations before any parallel evaluation starts.
The current validation rules are:
dimension() > 0memory_size > 0dimension * pop_size_multipliermust not overflow- initial population size must be at least
3 - every
(lower, upper)bound pair must be finite and satisfylower < upper
with_max_evaluations() is a soft budget, not a hard cap:
- the initial population is always evaluated in full
- each generation evaluates a full batch of trial vectors in parallel
- total objective evaluations can exceed the configured budget
- the overrun is bounded by at most one current-generation population size
License
This project is licensed under the MIT license. See LICENSE.