evox.algorithms.so.pso_variants.sl_pso_gs

Module Contents

Classes

SLPSOGS

The basic Particle Swarm Optimization Social Learning PSO Using Gaussian Sampling for Demonstrator Choice (SLPSOGS) algorithm.

API

class evox.algorithms.so.pso_variants.sl_pso_gs.SLPSOGS(pop_size: int, lb: torch.Tensor, ub: torch.Tensor, social_influence_factor: float = 0.2, demonstrator_choice_factor: float = 0.7, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

The basic Particle Swarm Optimization Social Learning PSO Using Gaussian Sampling for Demonstrator Choice (SLPSOGS) algorithm.

Class Methods

  • __init__: Initializes the SLPSOGS algorithm with given parameters (population size, inertia weight, cognitive weight, and social weight).

  • setup: Initializes the SLPSOGS algorithm with given lower and upper bounds for particle positions, and sets up initial population, velocity, and buffers for tracking best local and global positions and fitness values.

  • step: Performs a single optimization step using Particle Swarm Optimization (SLPSOGS), updating local best positions and fitness values, and adjusting velocity and positions based on inertia, cognitive, and social components.

Note that the evaluate method is not defined in this class, it is a proxy function of Problem.evaluate set by workflow; therefore, it cannot be used in class methods other than step.

Initialization

Initialize the SLPSOGS algorithm with the given parameters.

Parameters:
  • pop_size – The size of the population.

  • lb – The lower bounds of the particle positions. Must be a 1D tensor.

  • ub – The upper bounds of the particle positions. Must be a 1D tensor.

  • w – The inertia weight. Defaults to 0.6.

  • phi_p – The cognitive weight. Defaults to 2.5.

  • phi_g – The social weight. Defaults to 0.8.

  • device – The device to use for the tensors. Defaults to None.

init_step()[source]
step()[source]

Perform a normal optimization step using SLPSOGS.