1: |
P←INITIALIZE(pSize) |
|
2: |
for each particle in P
| |
3: | v←INITIALIZE_V() |
|
4: | p←INITIALIZE_P() |
|
5: | pbest←INITIALIZE_PB() |
|
6: |
gbest←INITIALIZE_GB() |
|
7: |
fitnessgbest
←COMPUTEFITNESS(gbest) |
|
8: |
count←0 |
|
9: |
gbesttemp
←gbest
| |
10: |
fitnesstemp
←fitnessgbest
| |
11: |
for each iteration | |
12: | for each particle in P
| |
13: | v←UPDATE_v(p, v, pbest, gbest) |
|
14: | p←UPDATE_p(p, v) |
|
15: | fitnesscurrent
←COMPUTEFITNESS(p) |
|
16: | fitnesspbest
←COMPUTEFITNESS(pbest) |
|
17: | if fitnesscurrent<fitnesspbest
then
| |
18: | pbest←p
| |
19: | fitnesspbest
←fitnesscurrent
| |
20: | if fitnesspbest<fitnesstemp
then
| |
21: | gbesttemp
←pbest
| |
22: | fitnesstemp
←fitnesspbest
| |
23: | if fitnesstemp<fitnessgbest
then
| |
24: | gbest←gbesttemp
| |
25: | fitnessgbest
←fitnesstemp
| |
26: | count←0 | |
27: | else
| |
28: | count←count+1 | |
29: | if count >tf
then
|
|
30: | for each particle in P
|
|
31: | v←INITIALIZE_V() |
|
32: | p←INITIALIZE_P() |
|
33: | pbest←INITIALIZE_PB() |
|
34: | count←0 | |