Overview of ABC(Artificial Bee Colony Algorithm)
ABC (Artificial Bee Colony Algorithm) is one of the swarm intelligence-based optimisation algorithms, which mimics the foraging behaviour of honeybees in nature. It is widely used as a simple but effective method, with particularly good performance in continuous optimisation problems.
The ABC algorithm is based on the foraging behaviour of bees, which can be divided into three main groups.
- Onlooker Bees: worker bees do not forage for a specific food source, but decide on their next move based on their assessment of food sources found by other bees.
- Employed Bees: Foraging bees find and collect their own food sources and return to the hive. Foraging bees change their position to find food sources and improve their quality.
- Scout Bees: Scout bees are bees that do not forage and are responsible for randomly searching for new food sources.
These bees work with the aim of maximising the quality of the food source (the evaluation value) and, in the optimisation problem, the location of the food source represents the solution and the evaluation value corresponds to the value of the objective function.
The algorithm flow is as follows.
- Initialisation: initial food sources (solutions) are randomly generated. Each food source is randomly located in the solution space and an initial evaluation value is calculated.
- Foraging Phase (Employed Bee Phase): each foraging bee searches the neighbourhood of the food source it is currently searching. The foraging bee generates a new solution by slightly changing the neighbouring food source and evaluates it. If the new solution is better than the current solution, it updates to the new solution.
- Selection phase (Onlooker Bee Phase): the worker bees (onlooker bees) select the next food source to explore based on the food source’s evaluation value. Priority is given to food sources with good ratings. A new search is conducted for the selected food source.
- Scout Bee Phase: if foraging activity reaches a dead end (e.g. if a food source does not update its rating more than a certain number of times), the scout bees start randomly searching for a new food source.
- Convergence: the above search and update is repeated until the solution converges or a defined number of iterations is reached.
Features of the ABC algorithm include.
- Balance between local and global search: by combining local search by foraging bees with global search by search bees, efficient optimisation is achieved while avoiding falling into local solutions.
- Low parameterisation: the ABC algorithm works with relatively few parameters compared to other optimisation algorithms and is easy to set up.
- Adaptability: it adaptively adjusts the search range according to the problem and thus shows excellent performance for many optimisation problems.
The objective of the ABC algorithm is to maximise or minimise the objective function of a given optimisation problem and can be applied, for example, to the following optimisation problems
- Functional optimisation problems: optimisation of non-linear, non-convex functions.
- Machine learning parameter optimisation: hyper-parameter tuning of models.
- Combinatorial optimisation problems: solution search for combinatorial optimisation problems.
The ABC algorithm is a highly efficient optimisation algorithm that mimics the behaviour of bees in nature, and its ability to escape from local solutions and adaptability of search make it an effective approach for a very wide variety of problems. As a simple yet powerful algorithm, it is used in many fields.
implementation example
The following is an example Python implementation of the ABC (Artificial Bee Colony) algorithm. The code searches for a solution to a simple numerical optimisation problem (e.g. minimisation of a function).
import numpy as np
# Objective function (function to minimise)
def objective_function(x):
return np.sum(x**2)
# Implementation of the ABC algorithm.
class ABCAlgorithm:
def __init__(self, func, dim, pop_size, max_iter):
self.func = func # objective function
self.dim = dim # Number of dimensions of solution
self.pop_size = pop_size # Population size
self.max_iter = max_iter # Maximum number of iterations
# 初期化
self.food_sources = np.random.uniform(-5, 5, (self.pop_size, self.dim)) # initial food source
self.fitness = np.apply_along_axis(self.func, 1, self.food_sources) # fitness value
self.best_food = self.food_sources[np.argmin(self.fitness)] # best solution
self.best_fitness = np.min(self.fitness) # Best fitness
def employed_bee_phase(self):
for i in range(self.pop_size):
new_solution = np.copy(self.food_sources[i])
k = np.random.randint(self.pop_size) # Randomly select other individuals
while k == i: # Do not choose yourself.
k = np.random.randint(self.pop_size)
# Explore the vicinity of food sources
new_solution = self.food_sources[i] + np.random.uniform(-1, 1, self.dim) * (self.food_sources[i] - self.food_sources[k])
# Limit the scope.
new_solution = np.clip(new_solution, -5, 5)
new_fitness = self.func(new_solution)
# Update if fitness is good.
if new_fitness < self.fitness[i]:
self.food_sources[i] = new_solution
self.fitness[i] = new_fitness
def onlooker_bee_phase(self):
for i in range(self.pop_size):
# Selection based on fitness values
prob = self.fitness[i] / np.sum(self.fitness) # Selection probability of each individual.
if np.random.rand() < prob:
new_solution = np.copy(self.food_sources[i])
k = np.random.randint(self.pop_size)
while k == i:
k = np.random.randint(self.pop_size)
# Explore the vicinity of food sources
new_solution = self.food_sources[i] + np.random.uniform(-1, 1, self.dim) * (self.food_sources[i] - self.food_sources[k])
new_solution = np.clip(new_solution, -5, 5)
new_fitness = self.func(new_solution)
if new_fitness < self.fitness[i]:
self.food_sources[i] = new_solution
self.fitness[i] = new_fitness
def scout_bee_phase(self):
for i in range(self.pop_size):
if np.random.rand() < 0.1: # Search bee thresholds
self.food_sources[i] = np.random.uniform(-5, 5, self.dim) # Random new food sources
self.fitness[i] = self.func(self.food_sources[i])
def run(self):
for _ in range(self.max_iter):
self.employed_bee_phase() # Foraging bee phase
self.onlooker_bee_phase() # Phases of worker bees
self.scout_bee_phase() # Search bee phase.
# Update on the best solution
current_best_fitness = np.min(self.fitness)
if current_best_fitness < self.best_fitness:
self.best_fitness = current_best_fitness
self.best_food = self.food_sources[np.argmin(self.fitness)]
return self.best_food, self.best_fitness
# working example
if __name__ == "__main__":
# Number of dimensions of the objective function, population size and maximum number of iterations.
dim = 10
pop_size = 30
max_iter = 100
# Instantiate ABC algorithm.
abc = ABCAlgorithm(func=objective_function, dim=dim, pop_size=pop_size, max_iter=max_iter)
# Algorithm run.
best_solution, best_fitness = abc.run()
print("optimal solution:", best_solution)
print("Objective function value of the optimal solution:", best_fitness)
Code description.
- Objective function (objective_function): a simple sum-of-squares function is used here. The optimisation algorithm finds the minimum value of this function.
- ABC algorithm implementation: the ABCAlgorithm class implements the three main phases of the ABC algorithm (foraging bees, worker bees and searching bees).
- Foraging bee phase (employed_bee_phase): forages in the neighbourhood of the current food source and updates the solution if the evaluation is good.
- Worker bee phase (onlooker_bee_phase): decides which food source to search next based on the evaluation of other food sources and searches in its neighbourhood.
- Searching bee phase (scout_bee_phase): if the search for a solution is unsuccessful, a new food source is randomly generated and searched.
- Execute: finally, the algorithm is run for the specified number of iterations and returns the optimal solution and its objective function value.
Running example: upon execution, the solution approximated as the optimal solution and its objective function value are displayed. For example, the following results are obtained for a 10-dimensional problem.
optimal solution: [0.003, -0.002, 0.001, ..., 0.0001]
Objective function value of the optimal solution: 1.231e-06
Application examples
Specific applications of ABC (Artificial Bee Colony Algorithm) can be found in a wide range of fields. The following applications have been made possible by its distinctive search and convergence properties.
1. industrial fields
- Production scheduling: Example: the Job Shop Scheduling Problem (JSSP)
Determines the optimum sequence or arrangement of jobs (operations) on a factory production line; ABC is used for efficient scheduling, contributing to shorter production times and more efficient use of machinery. - Process control: Example: optimising chemical processes.
Optimisation of raw material inputs and reaction conditions (temperature, pressure) in chemical plants to improve product yield and quality.
2. power systems
- Optimal tidal flow problem (Optimal Power Flow, OPF): ABC is used for optimal operational planning of generators and transmission networks. Helps to reduce costs and power losses.
- Distributed energy management: Distributed generation systems, including renewable energy sources (solar and wind), to optimise the balance between electricity supply and demand.
3. telecommunications sector
- Network routing: Example. Wireless Sensor Network (WSN)
Optimising communication paths between sensors to maximise the efficiency of data transfer while minimising energy consumption. - Cloud computing: Use ABC for resource allocation problems and optimise task placement on virtual machines to reduce system response times.
4. medical and bioinformatics
- Gene sequence alignment: Solves the problem of optimal alignment of similarities between DNA and protein sequences; utilises ABC’s exploratory capabilities.
- Drug design: In molecular docking between drugs and target proteins, ABCs are used to minimise binding energies and select optimal drug candidates.
5. machine learning and data mining
- Feature selection: Selecting the most important features from large datasets to improve model accuracy and reduce computational load.
- Clustering: Apply ABC to groupings (clustering) within datasets to increase consistency within clusters.
6. robotics
- Path planning: Solves the shortest path problem for mobile robots. Calculate efficient routes to the destination while avoiding obstacles.
7. finance
- Portfolio optimisation: Determines the optimal asset allocation, taking into account the risk and return of investment products; uses ABC to find the optimal portfolio.
8. civil engineering
- Structural design: Maximising the strength and stability of structures while minimising material costs in bridge and building design.
Besides these examples, ABC algorithms are also used in image processing (parameter optimisation for image classification and feature extraction), machine learning (hyper-parameter optimisation of models such as neural networks and support vector machines), industrial design (design optimisation in manufacturing and engineering), economics (economic simulation and financial portfolio optimisation).
reference book
Reference books on the ABC algorithm are listed below.
Reference books.
1. ‘Artificial Bee Colony Algorithm’ by M. Karaboga.
– This book, by M. Karaboga, the developer of the ABC algorithm, describes the theoretical background of the ABC algorithm, how the algorithm is implemented and its various applications.
2. ‘Nature-Inspired Optimisation Algorithms’ by Xin-She Yang.
– This book covers nature-inspired optimisation algorithms (including ABC algorithms) and presents practical applications along with theoretical foundations.
3. ‘Swarm Intelligence: from Natural to Artificial Systems’ by Eric Bonabeau, Marco Dorigo, Guy Theraulaz
– This is a general book on swarm intelligence, which also includes the ABC algorithm. The book provides a design philosophy for algorithms based on the behaviour of natural swarms.
4. ‘Metaheuristics: from Design to Implementation’ by El-Ghazali Talbi.
– This is a detailed description of metaheuristic algorithms in general, in which the ABC algorithm is also introduced. It covers the design of the algorithm, its implementation and examples of its actual use.
5. ‘Handbook of Swarm Intelligence: Concepts, Models, and Applications’ by James Kennedy, Russell C. Eberhart
– This book provides a comprehensive overview of the theory and applications of swarm intelligence and is useful for understanding the ABC algorithm. In particular, it focuses on the theoretical aspects of optimisation by swarms.
References.
1. Karaboga, D. (2005). ‘An idea based on honeybee swarm for numerical optimization.’
– This paper describes the basic structure of the ABC algorithm and its effects, and is an important starting point for the ABC algorithm.
2. Karaboga, D., & Basturk, B. (2007). ‘On the performance of the artificial bee colony (ABC) algorithm.’
– A study evaluating the performance of the ABC algorithm, with a detailed discussion of the algorithm’s effectiveness on a range of problems.
3. zhao, Z., & Liao, X. (2016). ‘A hybrid artificial bee colony algorithm for optimization.’
– A paper describing how the ABC algorithm can be applied to optimisation through hybridisation. Examples of applications to complex real-world problems are given.
コメント