# Hybrid Artificial Protozoa-Based JADE for Attack Detection
## 3 Hybrid APO-JADE Optimization Algorithm
### APO-JADE Optimization Algorithm Description and Pseudocode  
The hybrid APO-JADE optimization algorithm (Algorithm 1) integrates the diverse behavioral strategies of the Artificial Protozoa Optimizer (APO) with the adaptive parameter control mechanisms of Adaptive Differential Evolution (JADE) to enhance optimization performance. The algorithm starts by initializing a population of candidate solutions uniformly within the defined bounds, ensuring diversity. Each individual in the population randomly selects one of five APO-inspired behaviors (foraging, dormancy, reproduction, autotrophy, or heterotrophy) to adjust its position, balancing exploration and exploitation. JADE's adaptive mechanisms dynamically adjust the crossover rate (\(CR\)) and mutation factor (\(F\)) based on historical performance, allowing the algorithm to adapt to the optimization landscape. Fitness evaluation determines the quality of each candidate solution, and a greedy selection mechanism ensures that only better-performing solutions replace existing ones. An archive of replaced solutions is maintained to preserve diversity and guide adaptive parameter adjustments. The hybrid algorithm iterates through these steps, continuously updating the population and parameters, until convergence criteria are met or the maximum number of iterations is reached. By combining APO's exploratory behaviors with JADE's adaptability, the hybrid algorithm aims to achieve superior convergence rates and solution accuracy across various optimization problems.  
```
1:Input: Population size (pop), Maximum iterations (Max_iter), Lower bounds (lb), Upper bounds (ub), Dimension (dim), Objective function (fobj)
2:Output: Best solution found (Best_pos), Best fitness value (Best_score)
3: Initialize the population \(\mathbf{P}\) using Equation (7)
4: Evaluate initial fitness of the population
5: Initialize archive \(\mathbf{A}\) as empty
6: Set initial crossover rate \(CR=0.5\)
7: Set initial mutation factor \(F=0.5\)
8:forgen = 1 to Max_iter do
9: Generate adaptive \(CR\) and \(F\) for each individual based on historical success
10:for i = 1 to pop do
11: Select a behavioral strategy for individual \(i\):
12:if behavior = foraging then
13: Update position using Equation (8)
14:elseif behavior = dormancy then
15: Update position using Equation (9)
16:elseif behavior = reproduction then
17: Update position using Equation (10)
18:elseif behavior = autotroph then
19: Update position using Equation (11)
20:elseif behavior = heterotroph then
21: Update position using Equation (12)
22:endif
23: Perform crossover to generate new candidate solution using Equation (14)
24: Evaluate the fitness of the new candidate solution
25:if new candidate solution is better then
26: Update archive \(\mathbf{A}\) with current solution
27: Replace current solution with new candidate solution
28:endif
29:endfor
30: Update adaptive parameters \(CR\) and \(F\) using Equations (16) and (17)
31: Record the best solution and fitness value of the current generation
32: Manage the size of archive \(\mathbf{A}\) to maintain diversity
33:endfor
34:return Best solution (Best_pos) and best fitness value (Best_score)
```  
**Algorithm 1**Pseudocode for Hybrid APO-JADE Optimization Algorithm.