Swarms in Torch
A home for swarming algorithms like PSO, Ant Colony, Sakana, and more in PyTorch primitives through an emphasis on use-ability, reliability, and performance.
Installation
You can install the package using pip
Usage
- We have just PSO now, but we're adding in ant colony and others!
from swarms_torch import ParticleSwarmOptimization
#test
pso = ParticleSwarmOptimization(goal="Attention is all you need", n_particles=100)
pso.optimize(iterations=1000)
- Ant Colony Optimization
Todo
Here are 10 swarming neural network algorithms, with brief overviews, algorithmic pseudocode, and potential use cases for each:
-
Particle Swarm Optimization (PSO)
- Overview: Simulates the social behavior of birds flocking or fish schooling. It adjusts trajectories of individual agents (particles) based on their own and their neighbors' best known positions.
- Pseudocode:
- Use Cases: Function optimization, neural network training, feature selection.
-
Ant Colony Optimization (ACO)
- Overview: Simulates the foraging behavior of ants to find paths through graphs. Uses pheromones to mark good paths, which evaporate over time.
- Pseudocode:
- Use Cases: Path finding, traveling salesman problem, network routing.
-
Bee Algorithm (BA)
- Overview: Simulates the behavior of honey bees finding optimal nectar sources.
- Pseudocode:
- Use Cases: Job scheduling, function optimization, image processing.
-
Firefly Algorithm (FA)
- Overview: Based on the flashing behavior of fireflies. Fireflies are attracted to each other depending on the brightness of their flashing.
- Pseudocode:
- Use Cases: Multi-modal optimization, feature selection, clustering.
-
Bat Algorithm (BA)
- Overview: Inspired by the echolocation behavior of bats. Bats fly randomly and adjust positions based on emitted and returned echoes.
- Pseudocode:
- Use Cases: Engineering design, tuning machine learning algorithms, scheduling.
-
Wolf Search Algorithm (WSA)
- Overview: Models the hunting behavior of gray wolves.
- Pseudocode:
- Use Cases: Neural network training, function optimization, game AI.
-
Fish School Search (FSS)
- Overview: Simulates the social behavior of fish schooling.
- Pseudocode:
- Use Cases: Load balancing, function optimization, robotics.
-
Cuckoo Search (CS)
- Overview: Based on the reproduction strategy of cuckoos. They lay eggs in host bird nests and those nests with the best eggs (solutions) will carry on to the next generation.
- Pseudocode:
- Use Cases: Engineering design optimization, image processing, numerical optimization.
-
Whale Optimization Algorithm (WOA)
- Overview: Simulates the bubble-net hunting strategy of humpback whales.
- Pseudocode:
- Use Cases: Structural optimization, neural network training, function optimization.
-
Grasshopper Optimization Algorithm (GOA)
- Overview: Simulates the swarming behavior of grasshoppers towards food sources.
- Pseudocode:
- Use Cases: Job scheduling, clustering, neural network training.
License
MIT