Lagrangian and Sparse Control for Multi-agents Dynamics and Traffic