liveBook · Manning

Onlooker bee

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

An onlooker bee is an artificial-bee-colony agent that probabilistically selects food sources according to the quality of their solutions.

An onlooker bee is an agent in the artificial bee colony (ABC) algorithm. It chooses a candidate solution, called a food source, based on its quality and searches nearby for an improvement. The idea comes from honeybee foraging: onlookers observe dances that communicate where promising food sources are. section 10.4 section 10.5

In one ABC iteration, the roles work together:

  • Employed bees search around their current food sources and share the resulting solution quality. section 10.5
  • Onlooker bees choose sources probabilistically: better fitness gives a source a greater chance of selection. Each onlooker then evaluates a neighbor of its chosen source. section 10.5
  • Scout bees replace sources that have stopped improving with newly discovered sources, adding exploration to the onlookers’ local exploitation. section 10.5

Choosing a source in a minimization problem

For six candidate solutions to the Rosenbrock function, one candidate has an objective value of 15.15 and a selection probability of 0.49. Another has an objective value of 174.02 and a probability of 0.04. The better candidate is much more likely to attract an onlooker, but the choice remains probabilistic. In the Python implementation, nonnegative objective values are converted to fitness weights using 1 / (1 + value), then normalized into selection probabilities. section 10.5

To experiment, run ABC on the two-dimensional Rosenbrock function and inspect both the best fitness and the selected position. The supplied implementations show a Python version and a MEALPY OriginalABC version. Selection favors promising sources; it does not by itself guarantee the global optimum. section 10.5 section 10.6

Table 10.3 Solution fitness calculations (view table figure)

Candidate solution Xm

Objective function fm(Xm)

Fitness fitm(Xm)

Probability of selection pm

X1 = (–1.04,0.11)

98.56

0.010

0.08

X2 = (–1.10,–0.10)

174.02

0.006

0.04

X3 = (–0.75,0.22)

15.15

0.062

0.49

X4 = (–1.10,0.29)

88.87

0.011

0.09

X5 = (–0.86,0.10)

43.76

0.022

0.18

X6 = (–1.00,0.26)

59.66

0.016

0.13

Compare each candidate’s objective value, fitness, and selection probability to see how source quality influences an onlooker’s choice. section 10.5

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Works through selection probabilities and neighborhood evaluation, then demonstrates implementations; does not establish a convergence guarantee.
Examples
Uses six Rosenbrock candidates with calculated selection probabilities and Python and MEALPY optimization runs.
What it assumes
Defines bee roles and fitness-weighted selection before demonstrating Python code.
What you can do after
Build it from scratch in Python or apply it via MEALPY OriginalABC to minimize the Rosenbrock function.
How it connects
Connects employed bees, scout bees, fitness-proportionate selection, neighborhood search, and the exploration–exploitation balance.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.