Skip to content

Strength Pareto Evolutionary Algorithm 2 ​

Multi-Objective

Strength Pareto Evolutionary Algorithm 2 (SPEA2) multi-objective optimizer.

Algorithm Overview ​

This module implements SPEA2, an improved version of the Strength Pareto Evolutionary Algorithm for multi-objective optimization.

Usage ​

python
from opt.multi_objective.spea2 import SPEA2
from opt.benchmark.functions import sphere

optimizer = SPEA2(
    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
objectiveslist[Callable]RequiredList of objective functions to minimize.
lower_boundfloatRequiredLower bound of search space.
upper_boundfloatRequiredUpper bound of search space.
dimintRequiredProblem dimensionality.
max_iterintRequiredMaximum number of generations.
population_sizeint100Number of individuals in population.
archive_sizeint100External archive size.

Algorithm Metadata ​

PropertyValue
Algorithm NameStrength Pareto Evolutionary Algorithm 2
AcronymSPEA2
Year Introduced2001
AuthorsZitzler, Eckart; Laumanns, Marco; Thiele, Lothar
Algorithm ClassMulti-Objective
ComplexityO(MΒ² log M) per generation
PropertiesArchive-based, Population-based, Derivative-free
ImplementationPython 3.10+
COCO CompatibleYes

Mathematical Formulation ​

Strength: For individual i , strength S(i) is number of solutions it dominates:

S(i)=|{j∈PβˆͺA∣i≻j}|

Raw Fitness: Sum of strengths of dominators of i :

R(i)=βˆ‘j∈PβˆͺA,j≻iS(j)

where P = population, A = archive, j≻i means j dominates i .

Density Estimation: k-th nearest neighbor distance in objective space:

D(i)=1Οƒik+2

where Οƒik is distance to k -th nearest neighbor ( k=N+Nβ€² ).

Total Fitness: Lower is better:

F(i)=R(i)+D(i)

Archive Truncation: Iteratively remove individual with smallest distance to nearest neighbor until archive size constraint satisfied.

Constraint handling:

  • Boundary conditions: Clamping to bounds after SBX/mutation
  • Feasibility enforcement: Clip operator ensures bound satisfaction

Hyperparameters ​

ParameterDefaultBBOB RecommendedDescription
population_size10050-200Number of individuals
archive_size100= population_sizeExternal archive size
max_itervaries10000Maximum generations
crossover_rate0.90.9-1.0SBX crossover probability
mutation_rate0.11/dimPolynomial mutation probability
eta_c1510-30SBX distribution index
eta_m2010-30Mutation distribution index

Sensitivity Analysis:

  • archive_size: High impact - controls Pareto front resolution
  • k-nearest neighbor: Medium impact - density estimation accuracy
  • Recommended tuning ranges: archive∈[50,200]

COCO/BBOB Benchmark Settings ​

Search Space:

  • Dimensions tested: 2, 3, 5, 10, 20, 40
  • Bounds: Function-specific (typically [-2, 2] for test problems)
  • Instances: 15 per function (BBOB multi-objective standard)

Evaluation Budget:

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

Performance Metrics (Multi-Objective):

  • Hypervolume (HV): Volume dominated by archive
  • Inverted Generational Distance (IGD): Convergence metric
  • Spread: Archive diversity measure
  • Epsilon Indicator: Approximation quality

Raises ​

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

Notes ​

  • Returns final archive after max_iter generations
  • Archive truncation maintains diversity via k-NN distance
  • Uses strength and density for fitness assignment

Computational Complexity:

  • Time per generation: O(M2log⁑M) where M=N+Nβ€² (pop + archive)
  • Dominance checking: O(M2)
  • Archive truncation: O(M2log⁑M) via k-NN distance sorting
  • Space complexity: O(Mβ‹…(d+m)) for combined population
  • BBOB budget usage: Typically 70-85% of dim*10000 budget for convergence

BBOB Performance Characteristics (Multi-Objective):

  • Best function classes: Irregular/disconnected Pareto fronts, 2-3 objectives
  • Weak function classes: Many-objective (>3), highly separable problems
  • Typical Hypervolume: 80-92% of reference front (bi-objective, dim=5)
  • Archive maintains excellent diversity on complex fronts

Convergence Properties:

  • Convergence rate: Moderate - balanced between convergence and diversity
  • Diversity: Excellent via k-NN density estimation and truncation
  • Premature convergence risk: Low due to archive-based elitism

Reproducibility:

  • Deterministic: Partially - uses global numpy RNG (not seeded in current impl)
  • BBOB compliance: Requires seed parameter implementation for full compliance
  • Initialization: Uniform random sampling in [lower_bound, upper_bound]
  • RNG usage: Uses np.random (not seeded) - limitation for BBOB

Pareto Front Characteristics:

  • Strength-based fitness: Incorporates dominance count information
  • Density estimation: k-NN distance prevents overcrowding
  • Archive truncation: Preserves boundary and well-spread solutions
  • Environmental selection: Combines population and archive each generation

Implementation Details:

  • Parallelization: Not supported (sequential evaluation)
  • Constraint handling: Clamping to bounds after SBX/polynomial mutation
  • Numerical stability: Uses epsilon (1e-14) to prevent division by zero
  • k-value: Dynamically computed as N+Nβ€²

Known Limitations:

  • No seed parameter in current implementation (BBOB gap)
  • Archive truncation computationally expensive for large archives
  • Density estimation less effective in high-dimensional objective spaces
  • BBOB known issues: May maintain too much diversity at cost of convergence

Version History:

  • v0.1.0: Initial implementation with strength-based fitness and k-NN density

References ​

[1] Zitzler, E., Laumanns, M., & Thiele, L. (2001). "SPEA2: Improving the Strength Pareto Evolutionary Algorithm." TIK-Report 103, ETH Zurich, Swiss Federal Institute of Technology. https://www.research-collection.ethz.ch/handle/20.500.11850/145755

[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:

  • Original SPEA2: ETH Zurich, Computer Engineering and Networks Lab
  • This implementation: Based on [1] with BBOB multi-objective compliance

See Also ​

NSGAII: Non-dominated sorting genetic algorithm BBOB Comparison: SPEA2 uses archive with density-based truncation, NSGA-II uses crowding distance. Similar performance on most benchmarks.

MOEAD: Decomposition-based algorithm BBOB Comparison: SPEA2 better on irregular Pareto fronts, MOEA/D more efficient on convex fronts and many-objective problems.

AbstractMultiObjectiveOptimizer: Base class for multi-objective optimizers opt.benchmark.functions: BBOB-compatible multi-objective test functions

Related Multi-Objective Algorithms:

  • Pareto-based: NSGA-II, NSGA-III
  • Decomposition: MOEA/D, RVEA
  • Indicator-based: IBEA, SMS-EMOA

Benchmark Performance ​

Not covered by the benchmark suite

The benchmark suite compares single-objective optimizers on one scalar fitness. Multi-objective optimizers return a Pareto front and are not part of it.


Source Code

View the implementation: spea2.py

Released under the MIT License.