A particle is a candidate solution in particle swarm optimization. Its position encodes parameters such as shot velocity and angle, while its speed determines how the position changes during an update. section 4.2.1
A particle’s practical lifecycle includes:
- Generate its starting position within configured bounds and assign an initial speed. section 4.2.1
- Evaluate its fitness against the target objective and retain its own best position. section 4.2.1
- Adjust speed toward personal and swarm-wide best positions, clamp speed, and add it to the position. section 4.2.1
Cannon-shot parameters
Treat each particle as a guess for the velocity and angle needed to shoot a cannonball to a selected distance. Repeated evaluation and movement move the swarm toward better guesses. section 4.2.1
Listing 4.8 EDL_4_2_PSO.ipynb: Generating a particle
def generate(size, pmin, pmax, smin, smax): part = creator.Particle(np.random.uniform(pmin, pmax, size)) #1 part.speed = np.random.uniform(smin, smax, size) #2 part.smin = smin part.smax = smax return part
Inspect the minimal generator that creates a particle array, initializes its speed, and records speed bounds. section 4.2.1

