  Collective motion is an intriguing phenomenon, especially considering that it
arises from a set of simple rules governing local interactions between
individuals. In theoretical models, these rules are normally \emph{assumed} to
take a particular form, possibly constrained by heuristic arguments. We propose
a new class of models, which describe the individuals as \emph{agents}, capable
of deciding for themselves how to act and learning from their experiences. The
local interaction rules do not need to be postulated in this model, since they
\emph{emerge} from the learning process. We apply this ansatz to a concrete
scenario involving marching locusts, in order to model the phenomenon of
density-dependent alignment. We show that our learning agent-based model can
account for a Fokker-Planck equation that describes the collective motion and,
most notably, that the agents can learn the appropriate local interactions,
requiring no strong previous assumptions on their form. These results suggest
that learning agent-based models are a powerful tool for studying a broader
class of problems involving collective motion and animal agency in general.
