Skip to contents

Frequency f_i = fmin + (fmax - fmin) beta, velocity v_i <- v_i + (x_i - x*) f_i, position x_i + v_i; with probability 1 - r_i a local walk x* + eps mean(A). A move is accepted when no worse and a uniform draw is below the loudness A_i, which then decays (A <- alpha A) while r_i = r0 (1 - exp(-gamma t)).

Usage

BatAlgorithm(
  f,
  bounds,
  fmin = 0,
  fmax = 2,
  A0 = 1,
  r0 = 0.5,
  alpha = 0.9,
  gamma = 0.9,
  n_pop = 20,
  max_iter = 200,
  seed = 0
)

Arguments

f

Objective to minimise.

bounds

List of c(low, high) pairs or a two-column matrix.

fmin, fmax

Frequency range.

A0, r0

Initial loudness and pulse rate.

alpha, gamma

Loudness decay and pulse growth.

n_pop

Population size.

max_iter

Iterations.

seed

Philox seed.

Value

list(x, fun, estimate, history, n_fev, method).

References

Yang, X.-S. (2010). A new metaheuristic bat-inspired algorithm. Nature Inspired Cooperative Strategies for Optimization (NICSO 2010), Studies in Computational Intelligence 284, 65-74.

Examples

BatAlgorithm(function(x) sum(x^2), list(c(-5, 5), c(-5, 5)), max_iter = 50)$fun
#> [1] 0.002348788