teeline · algorithms/gsa
Gravitational Search Algorithm
Each candidate TSP tour is an agent with a mass proportional to its fitness — better tours weigh more. Every step, the active agent is pulled toward the k-best (heaviest) neighbours via swap-move velocity. The gravitational constant G decays over epochs, shifting the swarm from broad exploration toward fine-grained exploitation.
Agents
02025
12356
22051
32209
41732
51812
61959
72038
● gbest tour● active agent● swarm● city kbest source
Press Step or Run to begin
G (gravitational constant) = 20.00
High — broad exploration
epoch
0
step
0/8
gbest dist
1732.1
avg dist
2023
Balanced swarm size