Skip to content

Issue #9 – Particle Swarm Optimization (PSO) #9

Description

@D4R102004

Description: Implement Particle Swarm Optimization (PSO) in optimization/pso.py. This algorithm uses Numpy to simulate a "swarm" of particles where each particle (potential solution) moves based on its own experience and the experience of its neighbors. This is highly effective for continuous mathematical functions.

Objectives:

Implement the particle update physics: Velocity and Position.

Use Numpy vectorization to update the entire swarm simultaneously.

Implement the concepts of Personal Best (pbest) and Global Best (gbest).

Support inertia and acceleration coefficients to tune the swarm's behavior.

Tasks:

[ ] Implement optimization/pso.py:

    optimize(fitness_func, swarm_size, dimensions, steps): The main loop.

    Initialize X (positions) and V (velocities) as Numpy arrays.

[ ] The Velocity Update Formula:

    Implement: Vt+1​=wVt​+c1​r1​(pbest−Xt​)+c2​r2​(gbest−Xt​)

    w (inertia), c1​ (cognitive/personal), c2​ (social/global).

[ ] Boundary Handling:

    Ensure particles stay within the defined search space (clipping).

[ ] Unit Testing:

    Test the optimizer against a known function like the Sphere Function (where the goal is to reach 0 at coordinates [0,0]).

Acceptance Criteria:

[ ] The swarm successfully converges on a target point in a multi-dimensional space.

[ ] The implementation uses zero Python loops for the velocity and position updates (100% Numpy).

[ ] The user can pass custom w,c1​,c2​ parameters.

Dependencies:

Issue #1 (Project Initialization)

Issue #8 (Optimization/Numpy Infrastructure)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions