Search code examples
algorithmparticle-swarm

What are the content(elements) of posistion vector and velocity vector in the Particle Swarm Optimization (PSO) algorithm?


In the Particle Swarm Optimization (PSO) algorithm, the position of each particle represented by a row vector (x).

The same with velocity, it represented by a velocity vector (v)

I have found this in the Mathworks website:

...Particle i has position x(i), which is a row vector with nvars elements.

What are the contents (elements) of posistion vector and velocity vector? Why they are not a single value?

Is it right if we say that x and v are one dimension arrays (one row and N columns)?


Solution

  • What are the contents(elements) of posistion vector and velocity vector?

    The elements of the position are thee coordinates (see: https://en.wikipedia.org/wiki/Coordinate_system) which are used to parametrize space.

    Similarly for the velocity vector you have the velocity in each of the dimensions.

    So for instance if you have a 3D space, then the elements of position might be (x, y, z) and the elements of velocity could then be (vx, vy, vz)

    Why it is not a single value?

    In general it could be an arbitrary number of values - i.e. it could be a single value. But that would mean that your swarm lives in a 1-dimensional space and hence they could also only move back and forth along that dimension.

    Is it right if we say that x and v are one dimension arrays (one row and N columns)?

    In principle it is. Just make sure you don't mix implementation with the abstract algorithm. Most probably the vector is represented with an array as underlying data-structure. However, if it is one row with N columns (where N would be the dimensionality of the space where your swarm lives) or if it is N rows in a single column is a matter of how one interprets it. In Mathworks, as you quoted, it says "Particle i has position x(i), which is a row vector with nvars elements.", so I'd say for that implementation you are correct and the right interpretation is one row with nvars columns.