Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bees algorithm #6

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
8d929fc
test1811
kirstvh Nov 18, 2020
af4c026
Merge pull request #1 from kirstvh/master
kirstvh Nov 18, 2020
50ad30c
Update README.md
kirstvh Nov 25, 2020
36abd6d
Update README.md
kirstvh Nov 25, 2020
43929ea
test
tjvneste Dec 21, 2020
b6c1a4c
:tadaa: First step
tjvneste Dec 21, 2020
d68fc56
:tadaa: Alle functies geïmplementeerd
tjvneste Dec 21, 2020
528c4ac
Vergeten ABC erin te zetten
tjvneste Dec 21, 2020
41d8248
testing again
tjvneste Dec 21, 2020
dbdc11c
annotation perfection
tjvneste Dec 21, 2020
79a12e4
:tada:
tjvneste Dec 21, 2020
056a6ea
testtest
tjvneste Dec 21, 2020
3b8cbf2
:tada: new functions added
tjvneste Dec 21, 2020
d737557
Create ABCalgorithm_Tutorial.jl
kirstvh Dec 21, 2020
867cbad
tutorial
kirstvh Dec 21, 2020
7f4fdac
Update beesalgorithm.jl
kirstvh Dec 21, 2020
b79614a
testing
tjvneste Dec 21, 2020
d93e920
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
tjvneste Dec 21, 2020
1637fb3
update function
tjvneste Dec 21, 2020
684739a
ABC main
tjvneste Dec 21, 2020
a5d4a21
adding extra functions
tjvneste Dec 21, 2020
25fce65
test
tjvneste Dec 21, 2020
a814af8
td
tjvneste Dec 21, 2020
372dd12
:tada:
tjvneste Dec 21, 2020
c5f82a9
test
tjvneste Dec 21, 2020
0263d83
lalal
tjvneste Dec 21, 2020
ca58af9
ackley function
tjvneste Dec 21, 2020
2671d8a
Update BeesAlgorithm.jl
kirstvh Dec 21, 2020
5f24e21
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
kirstvh Dec 21, 2020
2237b9b
Update make.jl
kirstvh Dec 21, 2020
83a5b23
Create beesalgorithm.md
kirstvh Dec 21, 2020
465433d
Update beesalgorithm.md
kirstvh Dec 21, 2020
68f23aa
assert problems
tjvneste Dec 21, 2020
c890abf
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
tjvneste Dec 21, 2020
cb8de50
Testing_function done
tjvneste Dec 21, 2020
7036085
source_code
tjvneste Dec 21, 2020
a4c9c5b
Update BeesAlgorithm.jl
kirstvh Dec 21, 2020
34a036e
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
kirstvh Dec 21, 2020
89b0b96
Update beesalgorithm.md
kirstvh Dec 21, 2020
71c0ed2
first try making document
tjvneste Dec 21, 2020
35b1dd8
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
tjvneste Dec 21, 2020
3b9a69d
:tada: document finished
tjvneste Dec 21, 2020
2067c60
:tada: better expl for source
tjvneste Dec 22, 2020
aeef691
test
tjvneste Dec 22, 2020
6ed17f5
:) finishing
tjvneste Dec 22, 2020
fcebdf9
:tada: final final
tjvneste Dec 22, 2020
78eeea1
done
tjvneste Dec 22, 2020
57ab36a
finish part 10000
tjvneste Dec 22, 2020
3adc325
update
tjvneste Dec 22, 2020
b5cf0ed
document
tjvneste Dec 22, 2020
030c063
final
tjvneste Dec 22, 2020
04d886f
done
tjvneste Dec 22, 2020
060f5f7
update_version
tjvneste Dec 22, 2020
5afe0be
Update BeesAlgorithm.jl
kirstvh Dec 22, 2020
a46c34e
Update beesalgorithm.jl
kirstvh Dec 22, 2020
079ed46
Update beesalgorithm.jl
kirstvh Dec 22, 2020
16f663e
Update beesalgorithm.jl
kirstvh Dec 22, 2020
9723567
Update Project.toml
kirstvh Dec 22, 2020
12fddd8
Update beesalgorithm.jl
kirstvh Dec 23, 2020
e5ffbd7
try fix documentation employed bee
kirstvh Dec 23, 2020
7268649
test function added
kirstvh Dec 26, 2020
78220a3
scoutingphase
kirstvh Dec 26, 2020
e973344
PlutoUI
kirstvh Dec 26, 2020
49dd8d4
Update beesalgorithm.md
kirstvh Dec 26, 2020
c511358
:tada: reviewing Comments Michiel
tjvneste Dec 26, 2020
2563120
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
tjvneste Dec 26, 2020
1617334
:tada:
tjvneste Dec 26, 2020
e631674
:tada: final review
tjvneste Dec 26, 2020
24d305d
Update BeesAlgorithm.jl
kirstvh Dec 26, 2020
e8a5b46
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
kirstvh Dec 26, 2020
03ac268
Nelder-Mead
kirstvh Dec 26, 2020
81190d6
Update BeesAlgorithm.jl
kirstvh Dec 26, 2020
b224210
animation
kirstvh Dec 26, 2020
829ce13
animation 2
kirstvh Dec 26, 2020
6775068
animation
kirstvh Dec 26, 2020
6e3b539
:tada: animation
kirstvh Dec 26, 2020
7a529fd
Correct some errors
kirstvh Jan 7, 2021
1b16bd9
fix errors 2.0
kirstvh Jan 7, 2021
d10d18c
fix errors 3.0
kirstvh Jan 7, 2021
cf1fae7
fix error 4.0
kirstvh Jan 8, 2021
a951cb1
:tada: feedback other students
tjvneste Jan 8, 2021
b2b7f2b
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
tjvneste Jan 8, 2021
0b1e8b3
fix errrors notebook
kirstvh Jan 8, 2021
a98f210
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
kirstvh Jan 8, 2021
0809e1d
update tests
kirstvh Jan 8, 2021
3bcaec8
:tada: final feedback
tjvneste Jan 8, 2021
b9c52b0
Merge branch 'BeesAlgorithm' of https://github.com/kirstvh/STMOZOO in…
tjvneste Jan 8, 2021
e4060eb
final final
tjvneste Jan 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ version = "0.1.0"
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# STMO-ZOO

Welcome to the STMO zoo! This is your final assignment for the course Selected Topics in Mathematical Optimization. Your goal is to implement an optimization method in Julia and contribute this to this repository. To pass, you have to:
Expand All @@ -11,4 +12,4 @@ Welcome to the STMO zoo! This is your final assignment for the course Selected T

Depending on the project you choose some of these individual assignments might be really minimalistic, with other parts larger. For example, if you want to develop an application, say solving the graph coloring problem with Tabu Search, you might have only a single function in the source code (e.g., generating an instance) but have a fairly large notebook with a tutorial. On the other hand, if you work on a method, e.g., implementing Bee Colony Optimization, you might have many functions in the source code, while your notebook is only a demonstration on the test functions.

[![Build Status](https://travis-ci.org/MichielStock/STMOZOO.svg?branch=master)](https://travis-ci.org/MichielStock/STMOZOO)[![Coverage Status](https://coveralls.io/repos/github/MichielStock/STMOZOO/badge.svg?branch=master)](https://coveralls.io/github/MichielStock/STMOZOO?branch=master)
[![Build Status](https://travis-ci.org/MichielStock/STMOZOO.svg?branch=master)](https://travis-ci.org/MichielStock/STMOZOO)[![Coverage Status](https://coveralls.io/repos/github/MichielStock/STMOZOO/badge.svg?branch=master)](https://coveralls.io/github/MichielStock/STMOZOO?branch=master)
1 change: 1 addition & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[0108/001803.634:ERROR:directory_reader_win.cc(43)] FindFirstFile: Het systeem kan het opgegeven pad niet vinden. (0x3)
Binary file added docs/.DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ using Documenter

using STMOZOO
using STMOZOO.Example
using STMOZOO.BeesAlgorithm

makedocs(sitename="STMO ZOO",
format = Documenter.HTML(),
modules=[Example], # add your module
modules=[BeesAlgorithm], # add your module
pages=Any[
"Example"=> "man/example.md", # add the page to your documentation
"BeesAlgorithm" => "man/beesalgorithm.md", # add the page to your documentation
])

#=
Expand Down
Binary file added docs/src/.DS_Store
Binary file not shown.
57 changes: 57 additions & 0 deletions docs/src/man/beesalgorithm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## BeesAlgorithm

This documentation contains information about the functions implemented in the BeesAlgorithm module by Tristan and Kirsten.
The Artificial Bee Colonization (ABC) algorithm is a swarm-based metaheuristic for solving numerical optimization problems.
Apart from this algorithm and its required functions, also some test functions are provided to experiment with.

### Concept
##### General
The ABC algorithm is inspired by the **foraging behaviour of honey bees**. Honey bees collect nectar from flower patches as a food source for the colony. Bees are sent to explore different flower patches and they communicate the quality of these food sources through waggle dances. Good sites are continually exploited, while bees are sent out in search of additional promising sites.

##### Metaphor

As a methaphor for the foraging behaviour of bees, the ABC algorithm relies on three main components:

- **Food sources**, which can be considered as potential solutions of the optimization problem.

- **Employed foragers**. They exploit a food source, return to the colony to share their information with a certain probability, perform a waggle dance and recruit other bees, and then continue to forage at the food source.

- **Unemployed foragers**. This category consists of two types of bees. On the one hand, the **onlooker bees** watch the waggle dances to become a recruit and start searching for a food source. On the other hand, the **scout bees** start searching for interesting flower patches around the nest spontaneously.


The fitness of a solution or food source is inversely related with the value of the objective function in this solution. Thus, a higher fitness corresponds to a lower objective value. In the optimization process, we want to **maximize fitness** and **minimize the objective function** to find the minimizer of a continous function.


The following phases in the ABC algorithm can be distinguished:

**1) Employed bee phase**\
Employed bees try to identify better food source than the one they were associated previously. A new solution is generated using a partner solution. Thereafter, greedy selection is performed, meaning that a new solution only will be accepted if it is better than the current solution. Every bee in the swarm will explore one food source. All solutions get an opportunity to generate a new solution in the employed bee phase.

**2) Onlooker bee phase**\
In the onlooker bee phase, a food source is selected for further exploitation with a probability related to the nectar amount, i.e. a solution with higher fitness will have a higher probability to be chosen. Fitter solutions may undergo multiple onlooker bee explorations. As in the employed bee phase, new solutions are generated using a partner solution and greedy selection is performed. In contrast to the employed bee phase, not every food source will be explored, since every onlooker bee will explore a certain food source with a certain probability (depending on nectar amount).

During the two phases above, a trial counter is registered for every food source. Each time a food source fails to generate a solution with higher fitness, the trial counter is elevated by 1 unit.

The solution with highest fitness so far is kept apart in memory during the entire process and updated as better food sources are discovered.

**3) Scout bee phase**\
If the value of the trial counter for a certain solution is greater than fixed limit, then a solution can enter the scout phase. The latter food source is then considered as exhausted and will therefore be abandoned by the bees. After discarding the exhausted solution, a new random solution is generated and the trial counter of this solution is reset to zero.

### Functions

```@docs
Main.BeesAlgorithm.initialize_population
Main.BeesAlgorithm.compute_objective
Main.BeesAlgorithm.compute_fitness
Main.BeesAlgorithm.foodsource_info_prob
Main.BeesAlgorithm.create_newsolution
Main.BeesAlgorithm.employed_bee_phase
Main.BeesAlgorithm.onlooker_bee_phase
Main.BeesAlgorithm.scouting_phase
Main.BeesAlgorithm.ArtificialBeeColonization
Main.BeesAlgorithm.sphere
Main.BeesAlgorithm.ackley
Main.BeesAlgorithm.rosenbrock
Main.BeesAlgorithm.branin
Main.BeesAlgorithm.rastrigine
```
Loading