This repository contains a working implementation of the Particle Swarm Optimization (PSO) algorithm, a population-based meta-heuristic used for optimizing continuous functions. The project was developed as an assignment for the Fuzzy Systems and Evolutionary Computing course (A.Y. 2024/2025).
The implementation is fully compatible with the 'softpy' library interface, extending its capabilities to include swarm intelligence techniques.
- ParticleCandidate: inherits from 'softpy.FloatVectorCandidate'. It manages the position, velocity, and memory (best individual position) of each particle in the swarm.
- ParticleSwarmOptimizer: inherits from 'softpy.MetaHeuristicsAlgorithm'. It manages the swarm's evolution, handling local, neighborhood and global best positions to guide the particles toward the optimum.
- 'softpy/' : the core library provided by the instructor.
- 'particles.py' : implementation of the 'ParticleCandidate' class.
- 'PSO_algorithm.py' : implementation of the 'ParticleSwarmOptimizer' logic.
- 'test.py' : script to run and validate the optimizer on test functions.
- 'requirements.txt' : list of Python dependencies.
The velocity update follows the standard PSO formula: 'v = (inertia * v) + (rl * wl * (local_best - x)) + (rn * wn * (neighbor_best - x)) + (rg * wg * (global_best - x))'
Where:
- 'inertia': Controls the impact of the previous velocity.
- 'wl, wn, wg': Cognitive, Social, and Global weights.
- 'rl, rn, rg': Random components sampled at each iteration.
This project was developed as part of the Fuzzy Systems and Evolutionary Computing course, by Tsuhuy Ecaterina and Godino Tommaso.
It utilizes the softpy framewor, a Python library developed by Andrea Campagner (https://github.com/AndreaCampagner). You can find the original repository here: https://github.com/AndreaCampagner/softpy .