Contents:
BirdParticle
BirdParticle.evaluate()
BirdParticle.get_history()
BirdParticle.update_position()
BirdParticle.update_velocity()
PSO
PSO.get_best()
PSO.get_history()
PSO.get_points()
PSO.run()
PSO.save_history()
PSO.step()
Bases: object
object
Evaluates the current fitness of the particle.
costFunc (callable) – The cost function to be maximized.
model (torch.nn.Module) – The model to be used in the cost function.
Returns the history of the particle’s positions.
Updates the particle position based on its velocity.
Updates the particle velocity based on its own position and the global best position.
pos_best_g (torch.Tensor) – The global best position.
Returns the history of the swarm’s positions for each epoch.
Runs the Adversarial Particle Swarm Optimization algorithm for the specified number of epochs.
Saves the history of the swarm’s positions for each epoch.
Performs one iteration of the Adversarial Particle Swarm Optimization algorithm.