Particle swarm optimization: Difference between revisions

Content deleted Content added
Change the test conditions
Line 21:
Initialize the particle's position with a [[Uniform distribution (continuous)|uniformly distributed]] random vector: '''x'''<sub>i</sub>&nbsp;~&nbsp;''U''('''b<sub>lo</sub>''',&nbsp;'''b<sub>up</sub>''')
Initialize the particle's best known position to its initial position: '''p'''<sub>i</sub>&nbsp;←&nbsp;'''x'''<sub>i</sub>
'''if''' ''f''('''p'''<sub>i</sub>) <> ''f''('''g''') '''then'''
update the swarm's best known position: '''g'''&nbsp;←&nbsp;'''p'''<sub>i</sub>
Initialize the particle's velocity: '''v'''<sub>i</sub>&nbsp;~&nbsp;''U''(-|'''b<sub>up</sub>'''-'''b<sub>lo</sub>'''|,&nbsp;|'''b<sub>up</sub>'''-'''b<sub>lo</sub>'''|)
Line 30:
Update the particle's velocity: '''v'''<sub>i,d</sub>&nbsp;←&nbsp;w '''v'''<sub>i,d</sub> + φ<sub>p</sub> ''r''<sub>p</sub> ('''p'''<sub>i,d</sub>-'''x'''<sub>i,d</sub>) + φ<sub>g</sub> ''r''<sub>g</sub> ('''g'''<sub>d</sub>-'''x'''<sub>i,d</sub>)
Update the particle's position: '''x'''<sub>i</sub>&nbsp;←&nbsp;'''x'''<sub>i</sub> + '''v'''<sub>i</sub>
'''if''' ''f''('''x'''<sub>i</sub>) <> ''f''('''p'''<sub>i</sub>) '''then'''
Update the particle's best known position: '''p'''<sub>i</sub>&nbsp;←&nbsp;'''x'''<sub>i</sub>
'''if''' ''f''('''p'''<sub>i</sub>) <> ''f''('''g''') '''then'''
Update the swarm's best known position: '''g'''&nbsp;←&nbsp;'''p'''<sub>i</sub>