Skip to content

aomader/abc-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abc-algorithm Build Status Coverage Status

A Rust implementation of the Artificial Bee Colony (ABC) Algorithm by Karaboga [1].

Usage

#![feature(iter_arith)]

extern crate abc_algorithm;

use std::f64::consts::PI;

fn main() {
    let solution = abc_algorithm::Config::new()
        .stop(abc_algorithm::StopCriterion::TargetValue(0.0, 1.0e-10))
        .optimize(2, -5.0, 5.0, &ackley);

    println!("Best solution: {:?}", solution);
}

fn ackley(xs: &[f64]) -> f64 {
    let a = 20.0;
    let b = 0.2;
    let c = 2.0 * PI;

    -a * (-b * (xs.iter().map(|&x| x.powi(2)).sum::<f64>() / xs.len() as f64).sqrt()).exp() -
        (xs.iter().map(|&x| (c*x).cos()).sum::<f64>() / xs.len() as f64).exp() + a + 1.0f64.exp()
}

Documentation

For an exhaustive documentation head over to the API docs.

License

This software is licensed under the terms of the MIT license. Please see the LICENSE for full details.

References

[1]: Karaboga, D. (2005). An idea based on Honey Bee Swarm for Numerical Optimization. Technical Report TR06, Erciyes University, (TR06), 10. http://doi.org/citeulike-article-id:6592152

About

A Rust implementation of the Artificial Bee Colony (ABC) algorithm by Karaboga.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages