If you are familiar with Python, I learned genetic algorithms and pso using deap. They have some excellent tutorials and docs.
PSO optimizes a problem by having a population of candidate solutions, here dubbed particles, and moving these particles around in the search-space according to simple mathematical formulae. The movements of the particles are guided by the best found positions in the search-space which are updated as better positions are found by the particles.
What is a particle?
A particle has a current position, velocity, and a record of past positions. Each particle has its own velocity and position update rules.
How does the optimization search work?
You run the algorithm for a given number of iterations. On each iteration update each particle's velocity and position. Then hope you find the solution or a solution that is good enough.
Imagine that your search objective is to find the star. At each iteration we find the particle that is closest to finding the star. Then move all the other particles in that direction.