Optimality, Synthesis and a Continuum Model for Collective Motion