@ARTICLE{10.3389/fphy.2020.00200, AUTHOR={Costa, Tiago and Laan, Andres and Heras, Francisco J. H. and de Polavieja, Gonzalo G.}, TITLE={Automated Discovery of Local Rules for Desired Collective-Level Behavior Through Reinforcement Learning}, JOURNAL={Frontiers in Physics}, VOLUME={8}, YEAR={2020}, URL={https://www.frontiersin.org/articles/10.3389/fphy.2020.00200}, DOI={10.3389/fphy.2020.00200}, ISSN={2296-424X}, ABSTRACT={Complex global behavior patterns can emerge from very simple local interactions between many agents. However, no local interaction rules have been identified that generate some patterns observed in nature, for example the rotating balls, rotating tornadoes and the full-core rotating mills observed in fish collectives. Here we show that locally interacting agents modeled with a minimal cognitive system can produce these collective patterns. We obtained this result by using recent advances in reinforcement learning to systematically solve the inverse modeling problem: given an observed collective behavior, we automatically find a policy generating it. Our agents are modeled as processing the information from neighbor agents to choose actions with a neural network and move in an environment of simulated physics. Even though every agent is equipped with its own neural network, all agents have the same network architecture and parameter values, ensuring in this way that a single policy is responsible for the emergence of a given pattern. We find the final policies by tuning the neural network weights until the produced collective behavior approaches the desired one. By using modular neural networks with modules using a small number of inputs and outputs, we built an interpretable model of collective motion. This enabled us to analyse the policies obtained. We found a similar general structure for the four different collective patterns, not dissimilar to the one we have previously inferred from experimental zebrafish trajectories; but we also found consistent differences between policies generating the different collective pattern, for example repulsion in the vertical direction for the more three-dimensional structures of the sphere and tornado. Our results illustrate how new advances in artificial intelligence, and specifically in reinforcement learning, allow new approaches to analysis and modeling of collective behavior.} }