Biogeography-based Optimization (BBO)¶
An evolutionary method for continuous problems, close in spirit to a genetic algorithm.
BBO ¶
BBO(*, keep_rate=0.2, alpha=1.0, mutation_rate=0.1, mutation_step_size=0.05, mutation_step_size_damp=0.99, **kwargs)
Biogeography-based Optimization (Simon, 2008).
Each solution is a habitat. The habitats are kept sorted from best to worst, and
their emigration rates mu go linearly from 1 (best) to 0 (worst), with immigration
rates lambda = 1 - mu. Every feature k of habitat i immigrates with probability
lambda_i from a habitat j != i chosen by roulette wheel on mu:
x_ik + alpha * (x_jk - x_ik). Every feature then mutates with probability
mutation_rate by a normal step. All new habitats are built from the same
population (synchronous). The best keep_rate share of the old habitats is kept,
and the rest of the population is filled with the best new habitats.
Parameters
keep_rate: share of the best habitats kept from one iteration to the next (elitism)alpha: migration step. 1 (the default) copies the feature. Smaller values blend it with the current one.mutation_rate: probability that a feature mutatesmutation_step_size: standard deviation of the mutation step (code units)mutation_step_size_damp: the step size is multiplied by this after every iteration
Unlike Simon (2008), each feature mutates with a fixed probability by a Gaussian step that shrinks over the run, and elitism keeps a share of the population.
Reference: Simon (2008), Biogeography-based optimization, IEEE Transactions on Evolutionary Computation 12(6), 702 to 713.
Example¶
import ypea
problem = ypea.Problem(
ypea.Real("x", shape=20, lb=-10, ub=10),
lambda sol: ypea.benchmarks.sphere(sol.x),
vectorized=True,
name="sphere",
)
alg = ypea.BBO(max_nfe=20_000)
result = alg.solve(problem, seed=1)
print(result.summary())
BBO on sphere
best objective value: 0.00193436
feasible: True (violation 0)
evaluations: 20000, iterations: 199, time: 0.0856 s, stopped by: max_nfe
Differs from Python: MATLAB draws its own random numbers, so the best value differs from Python's.
problem = ypea.Problem( ...
vars=ypea.Real("x", shape=20, lb=-10, ub=10), ...
objective=@(sol) ypea.benchmarks.sphere(sol.x), ...
vectorized=true, ...
name="sphere");
alg = ypea.BBO(max_nfe=20000);
result = alg.solve(problem, seed=1);
disp(result.summary())
BBO on sphere
best objective value: 0.00219278
feasible: true (violation 0)
evaluations: 20000, iterations: 199, time: 0.252 s, stopped by: max_nfe
Search on Rastrigin¶