|
8 | 8 | ## Description
|
9 | 9 |
|
10 | 10 | This repository implements several swarm optimization algorithms and visualizes their (intermediate) solutions.
|
11 |
| -To run the algorithms one can either use the command line interface or the API. |
| 11 | +To run the algorithms one can either use the CLI (recommended) or the API. |
12 | 12 | Currently, the following algorithms are implemented:
|
13 | 13 | * [Firefly Algorithm](#firefly-algorithm)
|
14 | 14 | * [Cuckoo Search](#cuckoo-search)
|
15 | 15 | * [Particle Swarm Optimization](#particle-swarm-optimization)
|
16 | 16 | * [Ant Colony Optimization](#ant-colony-optimization)
|
| 17 | +* [Artificial Bee Colony](#artificial-bee-colony) |
17 | 18 |
|
18 | 19 | ## Installation
|
19 | 20 |
|
20 | 21 | You can install the package with `pip` from [pypi](https://pypi.org/project/swarmlib):
|
21 | 22 |
|
22 | 23 | ```
|
23 |
| -pip3 install swarmlib |
| 24 | +pip install swarmlib |
24 | 25 |
|
25 | 26 | swarm --version
|
26 | 27 | ```
|
@@ -72,7 +73,7 @@ In addition to the cli you can also use the API:
|
72 | 73 | ```python
|
73 | 74 | from swarmlib import FireflyProblem, FUNCTIONS
|
74 | 75 |
|
75 |
| -problem = FireflyProblem(FUNCTIONS['michalewicz'], 14) |
| 76 | +problem = FireflyProblem(function=FUNCTIONS['michalewicz'], firefly_number=14) |
76 | 77 | best_firefly = problem.solve()
|
77 | 78 | problem.replay()
|
78 | 79 | ```
|
@@ -116,7 +117,7 @@ This repository also implements modified _particle swarm optimization_ that was
|
116 | 117 |
|
117 | 118 | #### Features
|
118 | 119 |
|
119 |
| -Enables to particle swarm optimization to one of the provided 2D functions. The algorithm tries to find the global minimum of the selected function. |
| 120 | +Enables particle swarm optimization to one of the provided 2D functions. The algorithm tries to find the global minimum of the selected function. |
120 | 121 |
|
121 | 122 | Currently two functions can be selected:
|
122 | 123 | * [ackley](https://www.sfu.ca/~ssurjano/ackley.html)
|
@@ -175,3 +176,41 @@ problem = ACOProblem(ant_number=10)
|
175 | 176 | path, distance = problem.solve()
|
176 | 177 | problem.replay()
|
177 | 178 | ```
|
| 179 | + |
| 180 | +### Artificial Bee Colony |
| 181 | + |
| 182 | +The Artificial Bee Colony (ABC) algorithm was initially proposed 2005 by Dervis Karaboga in his paper [An Idea Based on Honey Bee Swarm For Numerical Optimization](https://pdfs.semanticscholar.org/015d/f4d97ed1f541752842c49d12e429a785460b.pdf). |
| 183 | +In his paper Karaboga did not specify _how exactly_ new solutions shall be discovered. |
| 184 | + |
| 185 | +Research has shown that the flight behavior of birds, fruit flies and other insects model properties of Levy flights ([Brown, Liebovitch & Glendon, 2007](https://link.springer.com/article/10.1007/s10745-006-9083-4); [Pavlyukevich, 2007](https://arxiv.org/pdf/cond-mat/0701653.pdf)). Therefore, this library's ABC implementation leverages levy flights to generate new solutions. |
| 186 | + |
| 187 | +#### Features |
| 188 | + |
| 189 | +Enables the ABC algorithm to one of the provided 2D functions. The algorithm tries to find the global minimum of the selected function. |
| 190 | + |
| 191 | +Currently two functions can be selected: |
| 192 | +* [ackley](https://www.sfu.ca/~ssurjano/ackley.html) |
| 193 | +* [michalewicz](https://www.sfu.ca/~ssurjano/michal.html) |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | +The plot shows all _employee bees_ as _red_ markers, the _onlooker bees_ are visualized as _blue_ markers. The best bees of all (previous) iterations are indicated by _yellow_ markers. When an employee bee exceeded its maximum _trials_ the bee is assigned a new random position. This is visualized by a _dark grey_ transition. |
| 198 | +Since the onlooker bees pick up an employee bee's position randomly visualizing their transitions confuses rather than it helps understanding the algorithm and therefore is omitted. |
| 199 | + |
| 200 | +To print all available options execute: |
| 201 | + |
| 202 | +``` |
| 203 | +swarm bees -h |
| 204 | +``` |
| 205 | + |
| 206 | +#### API |
| 207 | + |
| 208 | +In addition to the cli you can also use the API: |
| 209 | + |
| 210 | +```python |
| 211 | +from swarmlib import ABCProblem, FUNCTIONS |
| 212 | + |
| 213 | +problem = ABCProblem(bees=10, function=FUNCTIONS['michalewicz']) |
| 214 | +best_bee = problem.solve() |
| 215 | +problem.replay() |
| 216 | +``` |
0 commit comments