pybop.optimisers._cuckoo#

Classes#

CuckooSearchImpl

Cuckoo Search (CS) optimisation algorithm, inspired by the brood parasitism

Module Contents#

class pybop.optimisers._cuckoo.CuckooSearchImpl(x0, sigma0=0.05, boundaries=None, pa=0.25)[source]#

Bases: pints.PopulationBasedOptimiser

Cuckoo Search (CS) optimisation algorithm, inspired by the brood parasitism of some cuckoo species. This algorithm was introduced by Yang and Deb in 2009.

The algorithm uses a population of host nests (solutions), where each cuckoo (new solution) tries to replace a worse nest in the population. The quality or fitness of the nests is determined by the cost function. A fraction of the worst nests is abandoned at each generation, and new ones are built randomly.

The pseudo-code for the Cuckoo Search is as follows:

  1. Initialise population of n host nests

  2. While (t < max_generations):
    1. Get a cuckoo randomly by Lévy flights

    2. Evaluate its quality/fitness F

    3. Choose a nest among n (say, j) randomly

    4. If (F > fitness of j):
      1. Replace j with the new solution

    5. Abandon a fraction (pa) of the worst nests and build new ones

    6. Keep the best solutions/nests

    7. Rank the solutions and find the current best

  3. End While

This implementation also uses a decreasing step size for the Lévy flights, calculated as sigma = sigma0 / sqrt(iterations), where sigma0 is the initial step size and iterations is the current iteration number.

Parameters: - pa: Probability of discovering alien eggs/solutions (abandoning rate)

References: - X. -S. Yang and Suash Deb, “Cuckoo Search via Lévy flights,”

2009 World Congress on Nature & Biologically Inspired Computing (NaBIC), Coimbatore, India, 2009, pp. 210-214, https://doi.org/10.1109/NABIC.2009.5393690.

  • S. Walton, O. Hassan, K. Morgan, M.R. Brown, Modified cuckoo search: A new gradient free optimisation algorithm, Chaos, Solitons & Fractals, Volume 44, Issue 9, 2011, Pages 710-718, ISSN 0960-0779, https://doi.org/10.1016/j.chaos.2011.06.004.

_suggested_population_size()[source]#

Inherited from Pints:PopulationBasedOptimiser. Returns a suggested population size, based on the dimension of the parameter space.

abandon_nests(idx)[source]#

Updates the nests to abandon the worst performers and reinitialise.

ask()[source]#

Returns a list of next points in the parameter-space to evaluate from the optimiser.

clip_nests(x)[source]#

Clip the input array to the boundaries if available.

f_best()[source]#

Returns the best score found so far.

levy_flight(alpha, size)[source]#

Generate step sizes via the Mantegna’s algorithm for Levy flights

name()[source]#

Returns the name of the optimiser.

running()[source]#

Returns True if the optimisation is in progress.

tell(replies)[source]#

Receives a list of function values from the cost function from points previously specified by self.ask(), and updates the optimiser state accordingly.

x_best()[source]#

Returns the best parameter values found so far.