Skip to main content
. 2022 Aug 10;22(16):5986. doi: 10.3390/s22165986
Algorithm 1. Proposed HNIDS method (EGA-with PSO)
Input: attributes set, Random population (RP), the maximum number of generations (Max_g), Binary vector
Output: Optimized individual generation RP(n)
Step1: Apply RF method to determine the best fitness value for each participant
   1.1 for each participant i to RP
   1.2 do
   1.3 determine the best fitness (i)
       1.3.1 call random_forest ();
   Step 2: Apply the enhanced selection process of GA
   2.1 while (iteration_count< n)
   2.2 call selection (i);
   2.2.1 set New_selected_value = selection (i);
   Step 3: Select best bit individuals using enhanced mutation and crossover (EGA)
   3.1 Choose the best fit
   3.1.1 if (New_selected_value == Best_fit), than
   3.2 if (Crossover_generation) than
   3.2.1 Choose two parents randomly (i_pa, i_pb)
   3.2.2 Generates offspring parent (i_pc) = Crossover_generation (i_pa, i_pb);
   3.3 else
   3.4 Call enhanced mutation process
   3.4.1 randomly select an independent value (i) from the parent set
   3.4.2 Generates offspring parent (i_pc) = Crossover_generation (i_pa, i_pb);
   3.5 else
   Step 4: Calculate the best fit (fitness value) for each participant
   4.1 if (New_selected_value == Best_fit)
   4.1.1 Process Best_fit
   4.2 else
   4.2.1 Interchange the least fit participants with offspring parent (i_pc)
   4.3 else
   Step 5: Apply the PSO method to check the outcome best fir
   5.1 New_Output_PSO = PSO_Rejected (offspring parent (i_pc))
   5.2 End
   Step 6: apply enhanced selection to generate a new population
   6.1 if (New_Output_PSO == Best_fit) then
   6.2 New_Output_PSO = New_Output_PSO + Current_PSO_Output
   6.3 else
   6.4 Call Enhanced_selection ();
   6.5 End