1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Set iteration counter i=0.
Set initial parameters: Termination condition: T_c; Population Size: Z; tournament probability:T_p
Step 1:
Generate the initial population P_i With the size Z.
Step 2: Evaluate P_i
If Pass the
Step 3:
Do while not
Select Elite = the best individual According to fitness value
For j =2 to z
Selects two parents (Pr1, Pr2) using selection operator with
probability T_p
Generate the offspring using crossover on the selected individuals using following formula:
Offspring=crossover(Pr1, Pr2)
Checks the validity of the offspring if not passes, then apply repair procedure.
If not checkIndividual (offspring) then
RepairGenes(offspring)
End if
Add offspring to the crossover population .
P_c Add (offspring)
Next j
Apply mutation using the following formula:
P_m=mutate(P_c)
Create a new generation From the Elite the individuals in P_m
I=i+1
Loop |
Partager