The artificial bee colony (ABC) algorithm searches for good solutions the way a colony searches for food. Each food source is a candidate solution; its quality is measured by an objective function. Bees repeatedly improve promising sources and explore new ones, balancing local exploitation against wider exploration. section 10.4 section 10.5
An ABC iteration assigns three complementary jobs:
- Employed bees search near their current food sources and keep improvements. section 10.5
- Onlooker bees favor sources according to shared fitness values, then search near their selections. section 10.5
- Scout bees replace sources that have failed to improve after a set number of trials with randomly discovered ones. section 10.5
Start with a population of sources, repeat those three phases, and remember the best solution found until a stopping condition is met. The abandonment limit controls when an unproductive source gives way to exploration. Random choices can help escape local optima, but they do not guarantee an optimal result on every run. section 10.5 section 10.6
Minimizing the Rosenbrock function
In a two-dimensional minimization example, six initial food sources have objective values from 30.62 to 2097.22. After new sources are evaluated, a source at (−0.75, 0.22) has value 15.15 and a selection probability of 0.49—the largest probability in the displayed comparison. A Python implementation with 50 bees, 1,000 iterations, and a 100-trial limit reports a best position near (1, 1) with an objective value of about 0.0000065. The example is also run through mealpy’s OriginalABC with a population size and abandonment limit supplied explicitly. section 10.5
Algorithm 10.1 Artificial bee colony algorithm
Initialization Phase: population of candidate solutions (food sources) are initialized REPEAT Forager Bee Phase: Each forager bee goes to a food source in her memory and determines a closest source, then evaluates its nectar amount and dances in the hive Onlooker Bee Phase: Each onlooker bee watches the dance of forager bees and chooses one of their sources depending on the dances, and then goes to that source. After choosing a neighbor around that, she evaluates its nectar amount. Scout Bee Phase: Abandoned food sources are determined and are replaced with the new food sources discovered by scout bees. Memorize the best food source (solution) achieved so far. UNTIL (termination criteria are met)
Follow the initialization, employed-bee, onlooker-bee, and scout-bee phases as a compact implementation checklist. section 10.5
