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 β
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 β
| Parameter | Type | Default | Description |
|---|---|---|---|
objectives | list[Callable] | Required | List of objective functions to minimize. |
lower_bound | float | Required | Lower bound of search space. |
upper_bound | float | Required | Upper bound of search space. |
dim | int | Required | Problem dimensionality. |
max_iter | int | Required | Maximum number of generations. |
population_size | int | 100 | Number of individuals in population. |
archive_size | int | 100 | External archive size. |
Algorithm Metadata β
| Property | Value |
|---|---|
| Algorithm Name | Strength Pareto Evolutionary Algorithm 2 |
| Acronym | SPEA2 |
| Year Introduced | 2001 |
| Authors | Zitzler, Eckart; Laumanns, Marco; Thiele, Lothar |
| Algorithm Class | Multi-Objective |
| Complexity | O(MΒ² log M) per generation |
| Properties | Archive-based, Population-based, Derivative-free |
| Implementation | Python 3.10+ |
| COCO Compatible | Yes |
Mathematical Formulation β
Strength: For individual
Raw Fitness: Sum of strengths of dominators of
where
Density Estimation: k-th nearest neighbor distance in objective space:
where
Total Fitness: Lower is better:
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 β
| Parameter | Default | BBOB Recommended | Description |
|---|---|---|---|
| population_size | 100 | 50-200 | Number of individuals |
| archive_size | 100 | = population_size | External archive size |
| max_iter | varies | 10000 | Maximum generations |
| crossover_rate | 0.9 | 0.9-1.0 | SBX crossover probability |
| mutation_rate | 0.1 | 1/dim | Polynomial mutation probability |
| eta_c | 15 | 10-30 | SBX distribution index |
| eta_m | 20 | 10-30 | Mutation distribution index |
Sensitivity Analysis:
archive_size: High impact - controls Pareto front resolutionk-nearest neighbor: Medium impact - density estimation accuracy- Recommended tuning ranges:
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:
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:
where (pop + archive) - Dominance checking:
- Archive truncation:
via k-NN distance sorting - Space complexity:
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
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:
- Benchmark results: https://coco-platform.org/testsuites/bbob-biobj/
- Multi-objective test suite: https://numbbo.github.io/coco-doc/bbob-biobj/functions/
- Code repository: https://github.com/Anselmoo/useful-optimizer
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.
Related Pages β
Source Code
View the implementation: spea2.py