evox.algorithms.so.pso_variants.sl_pso_us
¶
Module Contents¶
Classes¶
The basic Particle Swarm Optimization Social Learning PSO Using Uniform Sampling for Demonstrator Choice (SLPSOUS) algorithm. |
API¶
- class evox.algorithms.so.pso_variants.sl_pso_us.SLPSOUS(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 Uniform Sampling for Demonstrator Choice (SLPSOUS) 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 ofProblem.evaluate
set by workflow; therefore, it cannot be used in class methods other thanstep
.Initialization
Initialize the SLPSOUS 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.