|
| 1 | +# SEvoBench CEC2017 Problem Suite Documentation |
| 2 | + |
| 3 | +The `sevobench::problem` module provides a comprehensive implementation of the CEC2017 benchmark suite for single-objective real-parameter optimization. This document outlines its architecture, problem types, and usage patterns. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 1. Overview |
| 8 | +The CEC2017 module implements: |
| 9 | +- **30 Test Functions**: 3 categories of optimization problems |
| 10 | + - *Unimodal/Simple Multimodal* (F1-F3) |
| 11 | + - *Hybrid Functions* (F11-F20) |
| 12 | + - *Composition Functions* (F21-F30) |
| 13 | +- **Problem Infrastructure**: |
| 14 | + - Shifted/rotated problem variants |
| 15 | + - Hybrid function constructions |
| 16 | + - Composition function mechanisms |
| 17 | +- **Instance Management**: |
| 18 | + - Official instances with data loading |
| 19 | + - Random instance generation |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## 2. Core Components |
| 24 | + |
| 25 | +### 2.1 Problem Types (`cec_problem.hpp`) |
| 26 | +| Category | Problem IDs | Characteristics | |
| 27 | +|--------------------|-------------|---------------------------------| |
| 28 | +| Basic Functions | F1-F10 | Core optimization landscapes | |
| 29 | +| Hybrid Functions | F11-F20 | Combined function structures | |
| 30 | +| Composition Funcs | F21-F30 | Adaptive function combinations | |
| 31 | + |
| 32 | +### 2.2 Problem Transformations |
| 33 | +| Transformation | Description | Affected Problems | |
| 34 | +|--------------------|-------------------------------|-------------------------| |
| 35 | +| Shift | Offset search space | All problems | |
| 36 | +| Rotation | Coordinate system rotation | F4-F30 | |
| 37 | +| Shuffle | Dimension permutation | Hybrid/Composition funcs| |
| 38 | +| Bias | Fitness offset | All problems | |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## 3. Problem Configuration |
| 43 | + |
| 44 | +### 3.1 Problem Class Template |
| 45 | +```cpp |
| 46 | +template<int Index, int Dim, std::floating_point T> |
| 47 | +class cec2017 : public cec_common<Index, Dim, T, cec2017> { |
| 48 | + // Problem-specific evaluation logic |
| 49 | +}; |
| 50 | +``` |
| 51 | +
|
| 52 | +### 3.2 Suite Builder Pattern |
| 53 | +```cpp |
| 54 | +auto suite = problem::suite_builder<problem::cec2017>() |
| 55 | + .dim<30>() // 30D problem |
| 56 | + .type<double>() // Double precision |
| 57 | + .problem_index({1,4,7}) // Select F1, F4, F7 |
| 58 | + .instance_count(5) // Generate 5 random instances |
| 59 | + .build(); |
| 60 | +``` |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## 4. Key Features |
| 65 | + |
| 66 | +### 4.1 Basic Functions (F1-F10) |
| 67 | +| ID | Name | Formula | |
| 68 | +|----|----------------------|----------------------------------| |
| 69 | +| F1 | Bent Cigar | `f(x) = x₁² + 10⁶Σx_i²` | |
| 70 | +| F4 | Rosenbrock | `f(x) = Σ[100(x_i² - x_{i+1})² + (x_i -1)²]` | |
| 71 | +| F7 | Bi-Rastrigin | `f(x) = Σ[z_i² - 10cos(2πz_i) + 10]` | |
| 72 | + |
| 73 | +### 4.2 Hybrid Functions (F11-F20) |
| 74 | +**Construction Pattern:** |
| 75 | +```math |
| 76 | +f_{\text{hybrid}}(x) = \sum_{k=1}^K w_k \cdot f_k(z^{(k)}) |
| 77 | +``` |
| 78 | +Where subcomponents: |
| 79 | +- Use different base functions |
| 80 | +- Operate on rotated/shuffled subspaces |
| 81 | +- Combine through dynamic weighting |
| 82 | + |
| 83 | +### 4.3 Composition Functions (F21-F30) |
| 84 | +**Adaptive Mechanism:** |
| 85 | +```math |
| 86 | +f_{\text{comp}}(x) = \frac{\sum_{i=1}^m w_i [λ_i f_i(z^{(i)}) + bias_i]}{\sum_{i=1}^m w_i} |
| 87 | +``` |
| 88 | +With: |
| 89 | +- Automatic subfunction selection |
| 90 | +- Adaptive σ parameters |
| 91 | +- Rotated/shuffled coordinates |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## 5. API Reference |
| 96 | + |
| 97 | +### 5.1 Core Classes |
| 98 | +| Class | Responsibilities | |
| 99 | +|-------------------------|----------------------------------| |
| 100 | +| `cec_common` | Base problem infrastructure | |
| 101 | +| `suite` | Problem collection manager | |
| 102 | +| `single_problem` | Interface for individual functions | |
| 103 | + |
| 104 | +### 5.2 Key Methods |
| 105 | +| Method | Description | |
| 106 | +|---------------------------------|--------------------------------------| |
| 107 | +| `operator()` | Evaluate solution fitness | |
| 108 | +| `problem_information()` | Get bounds/optimum data | |
| 109 | +| `load_rotate_matrix()` | Load official rotation matrices | |
| 110 | +| `generate_problem_factory()` | Create problem instances | |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## 6. Usage Example |
| 115 | + |
| 116 | +```cpp |
| 117 | +#include "SEvoBench/sevobench.hpp" |
| 118 | + |
| 119 | +int main() { |
| 120 | + using namespace sevobench::problem; |
| 121 | + |
| 122 | + // Create CEC2017 suite with F15 in 10D |
| 123 | + auto suite = suite_builder<cec2017>() |
| 124 | + .dim<10>() |
| 125 | + .type<float>() |
| 126 | + .problem_index({15}) |
| 127 | + .instance_count(3) |
| 128 | + .build(); |
| 129 | + |
| 130 | + // Evaluate solution |
| 131 | + std::vector<float> x(10, 0.5f); |
| 132 | + for(auto& prob : suite) { |
| 133 | + auto fitness = prob(x); |
| 134 | + std::cout << "F15 Instance " << prob.instance() |
| 135 | + << " fitness: " << fitness << "\n"; |
| 136 | + } |
| 137 | +} |
| 138 | +``` |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## 7. Advanced Functionality |
| 143 | + |
| 144 | +### 7.1 Data Loading System |
| 145 | +**Official Instance Setup:** |
| 146 | +```cpp |
| 147 | +// Load official F17 data files |
| 148 | +cec2017<17, 30, double> official_prob("CEC2017_data/"); |
| 149 | +``` |
| 150 | +
|
| 151 | +**File Structure:** |
| 152 | +``` |
| 153 | +CEC2017_data/ |
| 154 | + ├── shift_data_17.txt |
| 155 | + ├── M_17_D30.txt |
| 156 | + └── shuffle_data_17_D30.txt |
| 157 | +``` |
| 158 | +
|
| 159 | +### 7.2 Random Instance Generation |
| 160 | +**Automatic Configuration:** |
| 161 | +```cpp |
| 162 | +// Generate random F24 instance |
| 163 | +cec2017<24, 50, float> random_prob(5); // Instance ID=5 |
| 164 | +``` |
| 165 | + |
| 166 | +**Generation Logic:** |
| 167 | +1. Random shift vectors in [-100, 100] |
| 168 | +2. Random orthogonal rotation matrices |
| 169 | +3. Random dimension permutations |
| 170 | + |
| 171 | +--- |
| 172 | + |
| 173 | +## 8. Benchmarking Considerations |
| 174 | + |
| 175 | +### 8.1 Evaluation Protocol |
| 176 | +1. Initialize population within [-100, 100]^D |
| 177 | +2. Use problem's `optimum_solution()` for error calculation: |
| 178 | + ```math |
| 179 | + \text{Error} = f(x) - f(x^*) |
| 180 | + ``` |
| 181 | +3. Track function evaluations (FES) |
| 182 | + |
| 183 | +### 8.2 Performance Tips |
| 184 | +- **Precision**: Use `double` for official result comparisons |
| 185 | +- **Vectorization**: Leverage SIMD for rotated coordinate calculations |
| 186 | +- **Memory**: Cache rotation matrices for hybrid/composition functions |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## 9. Contribution Guidelines |
| 191 | +1. Implement new problems via `cec_common` CRTP pattern |
| 192 | +2. Follow official problem specifications exactly |
| 193 | +3. Include data file parsing logic |
| 194 | +4. Maintain separate evaluation paths for: |
| 195 | + - Basic functions |
| 196 | + - Hybrid constructions |
| 197 | + - Composition mechanisms |
| 198 | +5. Support both pre-generated and random instances |
| 199 | +6. Validate against official MATLAB implementations |
0 commit comments