Army ants build a bridge with their bodies. (iam555man/Getty Images/iStock)

Army ants form colonies of millions yet have no permanent home. They march through the jungle each night in search of new foraging ground. Along the way they perform logistical feats that would make a four-star general proud, including building bridges with their own bodies.

The ants manage this coordination with no leader and with minimal cognitive resources. An individual army ant is practically blind and has a minuscule brain that couldn’t begin to fathom their elaborate collective movement.

“There is no leader, no architect ant saying, ‘We need to build here,’ ” said Simon Garnier, director of the Swarm Lab at the New Jersey Institute of Technology and co-author of a recent study that predicts when an army ant colony will decide to build a bridge.

Garnier’s study helps explain not only how unorganized ants build bridges, but also how they pull off the even more complex task of determining which bridges are worth building at all.

To see how this unfolds, take the perspective of an ant on the march. When it comes to a gap in its path, it slows down. The rest of the colony, still barreling along at 12 centimeters per second, comes trampling over its back. At this point, two simple rules kick in.

The first tells the ant that when it feels other ants walking on its back, it should freeze. “As long as someone walks over you, you stay put,” Garnier said.

This same process repeats in the other ants: They step over the first ant, but — uh-oh — the gap is still there, so the next ant in line slows, gets trampled and freezes in place. In this way, the ants build a bridge long enough to span whatever gap is in front of them. The trailing ants in the colony then walk over it.

There’s more to it than that, though. Bridges involve trade-offs. Imagine a colony of ants comes to a V-shaped gap in its path. The colony doesn’t want to go all the way around the gap — that would take too long — but it also doesn’t build a bridge across the widest part of the gap that would minimize how far the colony has to travel. That army ants don’t always build the distance-minimizing bridge suggests there’s some other factor in their unconscious calculation.

“In ecology when you see something like this, it usually means there’s a cost-benefit trade-off,” Garnier said. “You try to understand: What is the benefit, and what is the cost?”

The cost, ecologists think, is that ants trapped in bridges aren’t available for other tasks, such as foraging. At any time on a march, a colony might be maintaining 40 to 50 bridges, with as few as one and as many as 50 ants per bridge. In a 2015 paper, Garnier and his colleagues calculated that as much as 20 percent of the colony can be locked into bridges at a time. At this point, a shorter route just isn’t worth the extra ants it would take to create a longer bridge.

Except, of course, individual ants have no idea how many of their colony-mates are holding fast over a gap. And this is where the second rule kicks in. As individual ants run the “bridging” algorithm, they have a sensitivity to being stampeded. When traffic over their backs is above a certain level, they hold in place, but when it dips below some threshold — perhaps because too many other ants are now occupied in bridge-building themselves — the ant unfreezes and rejoins the march.

The recent study grew out of experiments conducted with army ants in the Panamanian jungle in 2014. Based on those observations, the researchers have created a model that quantifies ants’ sensitivity to foot traffic and predicts when a colony will bridge an obstacle and when it will decide, in a sense, that it’s better to go around.

“We’re trying to figure out if we can predict how much shortcutting ants will do given a geometry of their environment,” Garnier said.

Evolution has seemingly equipped army ants with just the right algorithm for on-the-go bridge building. Researchers working to build swarms of simple robots are still searching for the instructions that will allow their cheap machines to perform similar feats. One challenge they have to contend with is that nature makes ants more reliably, and at lower cost, than humans can fabricate swarm-bots, whose batteries tend to die. A second is that it’s very possible there’s more governing army ant behavior than two simple rules.

“We describe army ants as ­simple, but we don’t even understand what they’re doing. Yes, they’re simple, but maybe they’re not as simple as people think,” said ­Melvin Gauci, a researcher at Harvard University working on swarm robotics.

health-science@washpost.com

This report was first published in Quanta magazine.