  Flocking behavior has attracted considerable attention in multi-agent
systems. The structure of flocking has been predominantly studied through the
application of artificial potential fields coupled with velocity consensus.
These approaches, however, do not consider the energy cost of the agents during
flocking, which is especially important in large-scale robot swarms. This paper
introduces an optimal control framework to induce flocking in a group of
agents. Guarantees of energy minimization and safety are provided, along with a
decentralized algorithm that satisfies the optimality conditions and can be
realized in real time. The efficacy of the proposed control algorithm is
evaluated through simulation in both MATLAB and Gazebo.
