Reference: Karaboga D. An idea based on honey bee swarm for numerical optimization[J]. Technical Report-TR06, Kayseri, Turkey: Erciyes University; 2005.
Variables | Meaning |
---|---|
pop | The number of bees |
iter | The iteration number |
lb | The lower bound (list) |
ub | The upper bound (list) |
pos | The set of bees (list) |
score | The score of bees (list) |
dim | Dimension (list) |
trail | The non-improvement number of each solution (list) |
trail_limit | The maximum non-improvement number. Once exceed this number, the scout bee procedure is triggered. |
gbest | The score of the global best score |
gbest_pos | The position of the global best (list) |
iter_best | The global best score of each iteration (list) |
con_iter | The last iteration number when "gbest" is updated |
if __name__ == '__main__':
# Parameter settings
pop = 50
iter = 300
lb = [0, 0, 10, 10]
ub = [99, 99, 200, 200]
print(main(pop, iter, lb, ub))
The ABC converges at its 203-th iteration, and the global best value is 8050.913534658795.
{
'best score': 8050.913534658795,
'best solution': [1.3005502034963052, 0.6428626394484327, 67.3860209065443, 10.000000000000002],
'convergence iteration': 203
}