| Algorithm 1: BCA-Based Hyperparameter Optimization for CNN |
| Input: |
| D: Training dataset |
| M: CNN model structure |
| BCA_params: Algorithm parameters (bee_count, max_iterations, limit_T) |
| Output: |
| θ_best: Optimized hyperparameters (learning_rate, kernel_sizes, layer_depths) |
| W_best: Optimized weights |
| B_best: Optimized biases |
| 1: Initialize bee population: scouts, employed bees, onlookers |
| 2: Encode each bee as θ_i = (W_i, B_i) |
| 3: Define fitness f(θ_i) = CrossEntropyLoss(M(θ_i), D) |
| 4: for iteration = 1 to MaxIterations do |
| 5://Employed bee phase |
| 6: for each employed bee i do |
| 7: Generate new candidate: θ_new,i = θ_i + φ_i · (θ_i − θ_k) |
| 8: if f(θ_new,i) < f(θ_i) then θ_i ← θ_new,i |
| 9: end for |
| 10://Onlooker bee phase |
| 11: Calculate selection probability P_i = f(θ_i)/Σ f(θ_j) |
| 12: for each onlooker do |
| 13: Select bee i with probability P_i |
| 14: Perform local search as in Equation (5) |
| 15: end for |
| 16://Scout bee phase |
| 17: for each solution unchanged for T iterations do |
| 18: Replace with random new solution |
| 19: end for |
| 20://Elite preservation |
| 21: Update global best if improved |
| 22: end for |
| 23: return W_best, B_best |