| Crates.io | metaheurustics-rs |
| lib.rs | metaheurustics-rs |
| version | 0.2.0 |
| created_at | 2024-12-13 11:13:36.86674+00 |
| updated_at | 2025-01-19 08:31:22.656037+00 |
| description | A comprehensive collection of metaheuristic optimization algorithms implemented in Rust |
| homepage | |
| repository | https://github.com/aryashah2k/metaheuRUSTics |
| max_upload_size | |
| id | 1482082 |
| size | 216,467 |
A comprehensive collection of metaheuristic optimization algorithms implemented in Rust. This library provides efficient implementations of popular optimization algorithms along with visualization tools.
Multiple optimization algorithms:
Test functions for benchmarking:
Visualization tools:
Add this to your Cargo.toml:
[dependencies]
metaheurustics = "0.2.0"
Here's a simple example using PSO to optimize the Sphere function:
use metaheurustics::prelude::*;
use metaheurustics::algorithm::pso::{PSO, PSOParams};
use metaheurustics::test_function::Sphere;
fn main() {
let sphere = Sphere::new();
let pso_params = PSOParams::default();
let pso = PSO::new(&sphere, pso_params);
let result = pso.optimize();
println!("Best solution: {:?}", result.best_solution);
println!("Best fitness: {}", result.best_fitness);
}
Check out the examples directory for more detailed usage:
examples/plot_all.rs: Demonstrates visualization of all algorithms on different test functionsexamples/simple_optimization.rs: Shows basic usage of each optimization algorithmFor detailed documentation, visit docs.rs/metaheurustics
The library includes comprehensive benchmarks comparing the performance of different algorithms on various test functions. Run the benchmarks using:
cargo bench
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.