Particle swarm optimization (5)-----The implementation of standard particle swarm optimization algorithm

Source: Internet
Author: User
Tags data structures

The realization of the standard particle swarm optimization (PSO) algorithm is based on the particle Swarm algorithm (2)----the standard particle swarm optimization algorithm. It is mainly divided into 3 functions. The first function is the particle swarm initialization function

Initswarm (Swarmsize .....) ADAPTFUNC) Its main function is to initialize particles of particle swarm, and set the velocity and position of particles in a certain range. The data structures used in this function are as follows:

The table Parswarm records the position of the particle, the velocity and the current fitness value, we use W to represent the position, the velocity with V, and F to represent the current fitness value. Here we assume that the number of particles is n, and the dimension of each particle is d.

W1,1 W1,2 ... W1,d V1,1 V1,2 ... V1,d-1 V1,d F1 A 1th particle.
w 2,2 w 2,d v 2,1 v 2,2 v 2,d-1 v 2,d f 2 2nd particle
w n-1,2 w n-1,d-1 v n-1,1 v n-1,2 v n-1,d-1 v n-1,d f N-1 N-1 particle
Wn,1 Wn,2 ... Wn,d Vn,1 Vn,2 ... Vn,d-1 Vn,d FN Nth particle

The table Optswarm records the optimal solution of each particle's history (the best fitness for particle history) and the global optimal solution for all the particles. The global optimal solution is represented by the WG, and the w.,1 represents the historical optimal solution of each particle. The first n rows in the particle swarm initialization stage table Optswarm are the same as in the table Parswarm, and the WG's value is the row for the maximum value of the fitness value in the table Parswarm.

wj,1 wj,2 ... Wj,d-1 Wj,d The historical optimal solution of a 1th particle
wk,1 wk,2 ... Wk,d-1 Wk,d The historical optimal solution of a 2nd particle
... ... ... ... ... ...
wl,1 wl,2 ... Wl,d-1 Wl,d The historical optimal solution of the first N-1 particle
wm,1 wm,2 ... Wm,d-1 Wm,d The historical optimal solution of nth particle
wg,1 wg,2 ... Wg,d-1 Wg,d The historical optimal solution of global particles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.