Skip to content

Cultural Algorithm

Evolutionary

Cultural Algorithm (CA) optimization algorithm.

Algorithm Overview

This module provides an implementation of the Cultural Algorithm optimizer. The Cultural Algorithm is a population-based optimization algorithm that combines individual learning (exploitation) with social learning (exploration) to search for the best solution to a given optimization problem.

The CulturalAlgorithm class is the main class of this module. It inherits from the AbstractOptimizer class and implements the search method to perform the Cultural Algorithm search.

Example usage: optimizer = CulturalAlgorithm( func=shifted_ackley, dim=2, lower_bound=-2.768, upper_bound=+2.768 ) best_solution, best_fitness = optimizer.search() print(f"Best solution found: {best_solution}") print(f"Best fitness found: {best_fitness}")

Usage

python
from opt.evolutionary.cultural_algorithm import CulturalAlgorithm
from opt.benchmark.functions import sphere

optimizer = CulturalAlgorithm(
    func=sphere,
    lower_bound=-5.12,
    upper_bound=5.12,
    dim=10,
    max_iter=500,
    population_size=50,
)

best_solution, best_fitness = optimizer.search()
print(f"Best solution: {best_solution}")
print(f"Best fitness: {best_fitness:.6e}")

Parameters

ParameterTypeDefaultDescription
funcCallableRequiredObjective function to minimize.
lower_boundfloatRequiredLower bound of search space.
upper_boundfloatRequiredUpper bound of search space.
dimintRequiredProblem dimensionality.
population_sizeint100Number of individuals.
max_iterint1000Maximum iterations.
belief_space_sizeint20Belief space size.
scaling_factorfloat0.5Influence strength.
mutation_probabilityfloat0.5Mutation probability.
elitismfloat0.1Elite preservation rate.
seedint | NoneNoneRandom seed for reproducibility.

Algorithm Metadata

PropertyValue
Algorithm NameCultural Algorithm
AcronymCA
Year Introduced1994
AuthorsReynolds, Robert G.
Algorithm ClassEvolutionary
ComplexityO(NP * dim) per iteration
PropertiesPopulation-based, Derivative-free, Stochastic
ImplementationPython 3.10+
COCO CompatibleYes

Mathematical Formulation

Cultural algorithms combine population-based search with a belief space storing collective knowledge. Two key spaces evolve:

Population Space (similar to GA):

  • Selection, crossover, mutation on individuals

Belief Space (collective knowledge): Stores best solutions and their characteristics:

BS={(xi,f(xi)):f(xi)θ}

Influence Function: Belief space guides population evolution:

xi=xi+α(bsbestxi)+βN(0,σ2)

where:

  • BS is belief space (top-performing solutions)
  • θ is acceptance threshold for belief space
  • bsbest is best solution in belief space
  • α controls influence of belief space
  • β controls mutation strength
  • Population and belief space communicate bidirectionally

Constraint handling:

  • Boundary conditions: Clamping to bounds
  • Feasibility enforcement: Solutions clipped to valid range

Hyperparameters

ParameterDefaultBBOB RecommendedDescription
population_size10010*dimNumber of individuals
max_iter100010000Maximum iterations
belief_space_size200.2*pop_sizeNumber of solutions in belief space
scaling_factor0.50.3-0.7Influence strength
mutation_probability0.50.3-0.7Mutation probability
elitism0.10.05-0.2Elite preservation rate

Sensitivity Analysis:

  • belief_space_size: High impact - controls knowledge retention
  • scaling_factor: Medium impact - balances exploration/exploitation
  • Recommended tuning ranges: belief_space_size[10,50], scaling_factor[0.2,0.8]

COCO/BBOB Benchmark Settings

Search Space:

  • Dimensions tested: 2, 3, 5, 10, 20, 40
  • Bounds: Function-specific (typically [-5, 5] or [-100, 100])
  • Instances: 15 per function (BBOB standard)

Evaluation Budget:

  • Budget: dim×10000 function evaluations
  • Independent runs: 15 (for statistical significance)
  • Seeds: 0-14 (reproducibility requirement)

Performance Metrics:

  • Target precision: 1e-8 (BBOB default)
  • Success rate at precision thresholds: [1e-8, 1e-6, 1e-4, 1e-2]
  • Expected Running Time (ERT) tracking

Raises

ValueError: If search space is invalid or function evaluation fails.

Notes

  • Modifies self.history if track_history=True
  • Uses self.seed for all random number generation
  • BBOB: Returns final best solution after max_iter or convergence

Computational Complexity:

  • Time per iteration: O(NPn)
  • Space complexity: O((NP+BS)n) with belief space
  • BBOB budget usage: Typically uses 50-85% of dim*10000 budget

BBOB Performance Characteristics:

  • Best function classes: Moderately multimodal, Structured
  • Weak function classes: Highly ill-conditioned
  • Typical success rate at 1e-8 precision: 60-75% (dim=5)

Convergence Properties:

  • Convergence rate: Linear with knowledge acceleration
  • Local vs Global: Enhanced by belief space guidance
  • Premature convergence risk: Medium

Reproducibility:

  • Deterministic: Yes - Same seed guarantees same results
  • BBOB compliance: seed parameter required
  • Initialization: Uniform random sampling
  • RNG usage: numpy.random.default_rng(self.seed)

Implementation Details:

  • Parallelization: Not supported
  • Constraint handling: Clamping to bounds
  • Numerical stability: Standard precision

Known Limitations:

  • Belief space overhead for simple problems
  • BBOB known issues: None specific

Version History:

  • v0.1.0: Initial implementation

References

[1] Reynolds, R. G. (1994). "An Introduction to Cultural Algorithms." Proceedings of 3rd Annual Conference on Evolutionary Programming, Vol. 24, 131-139.

[2] Hansen, N., Auger, A., Ros, R., Mersmann, O., Tušar, T., Brockhoff, D. (2021). "COCO: A platform for comparing continuous optimizers in a black-box setting." Optimization Methods and Software, 36(1), 114-144. https://doi.org/10.1080/10556788.2020.1808977

COCO Data Archive:

Implementation:

  • This implementation: Dual inheritance model with belief space guidance

See Also

GeneticAlgorithm: Classical evolutionary without belief space BBOB Comparison: CA adds knowledge retention for potentially faster convergence

AbstractOptimizer: Base class for all optimizers opt.benchmark.functions: BBOB-compatible test functions

Related BBOB Algorithm Classes:

  • Evolutionary: GeneticAlgorithm, DifferentialEvolution
  • Swarm: ParticleSwarm
  • Gradient: AdamW, SGDMomentum

Benchmark Performance

Interactive fitness landscape of a representative multimodal benchmark function (drag to rotate, scroll to zoom):

Run-based charts

Convergence, distribution and ECDF charts appear here once this optimizer is included in the benchmark suite.


Source Code

View the implementation: cultural_algorithm.py

Released under the MIT License.