Army ant colonies display complex foraging raid patterns involving thousands of individuals communicating through chemical trails. In this article we explore, by means of a simple search algorithm, the properties of these trails in order to test the hypothesis that their structure reflects an optimized mechanism for exploring and exploiting food resources. The raid patterns of three army ant species, Eciton hamatum , Eciton burchelli , and Eciton rapax , are analyzed. The respective diets of these species involve large but rare, small but common, and a combination of large but rare and small but common food sources. Using a model proposed by Deneubourg et al. , we simulate the formation of raid patterns in response to different food distributions. Our results indicate that the empirically observed raid patterns maximize return on investment, that is, the amount of food brought back to the nest per unit of energy expended, for each of the diets. Moreover, the values of the parameters that characterize the three optimal pattern-generating mechanisms are strikingly similar. Therefore the same behavioral rules at the individual level can produce optimal colony-level patterns. The evolutionary implications of these findings are discussed.