Skip to content

juadolfob/Artificial_Bee_Colony_Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Artificial Bee Colony Algorithm

ABC, Artificial Bee Colony, Optimization Algorithm


Based on article:

Artificial Bee Colony (ABC) Optimization Algorithm for Solving Constrained Optimization Problems

Example

Class is designed to accept lambda functions but it will work with any method, and any number of parameters.

Ackley function:

Search domain: -40 > x, y < 40

Global minimun: 0

from ArtificialBeeColony import ABC
import math

ackley_function = lambda x, y: -20 * math.exp(-.02 * math.sqrt(0.5 * (x ** 2 + y ** 2))) - math.exp(
    0.5 * (math.cos(2 * math.pi * x) + math.cos(2 * math.pi * y))) + math.e + 20


sn = 10
limit = 50
mcn = 1000
bound = 40
beecolony = ABC(ackley_function, sn, bound, limit, mcn)

print(beecolony.best_solution())

>>> {
    'solution': [2.7091476396022223e-15, -1.998092029953233e-15],
    'function': 0.0,
    'fitness': 1.0,
    'trial': 39
    }
    

Clone

  • Clone this repo to your local machine using https://github.com/juadolfob/Artificial_Bee_Colony_Algorithm

todo: gradient optimization bfgs ACO

License

License

Copyright (c) 2020 juadolfob

About

Artificial bee colony algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages