Biological evolution of species is nothing but an optimization algorithm that moves the genetic makeup of a population of organisms towards higher fitness in their environment. The reasons behind the tendency of certain organisms, such as birds, fish and insects, to form collectives are quite varied but generally center around the search for food and avoiding predators. The behavior of swarms, such as a flock of birds or a school of fish, can be quite complex as a whole but the rules governing the behavior of individuals in a swarm are likely quite simple. This is simply a byproduct of the fact that an individual inside a dense swarm has limited visibility of what the rest of the swarm is doing. Unlike swarms such as bird flocks that rely mostly on vision, individual ants react to chemical signaling that has contributions from not just its nearest neighbors but potentially the entire colony.