  We study a family of optimal control problems in which one aims at minimizing
a cost that mixes a quadratic control penalization and the variance of the
system, both for finitely many agents and for the mean-field dynamics as their
number goes to infinity. While solutions of the discrete problem always exist
in a unique and explicit form, the behavior of their macroscopic counterparts
is very sensitive to the magnitude of the time horizon and penalization
parameter.
  When one minimizes the final variance, there always exists a
Lipschitz-in-space optimal controls for the infinite dimensional problem, which
can be obtained as a suitable extension of the optimal controls for the
finite-dimensional problems. The same holds true for variance maximizations
whenever the time horizon is sufficiently small. On the contrary, for large
final times (or equivalently for small penalizations of the control cost), it
can be proven that there does not exist Lipschitz-regular optimal controls for
the macroscopic problem.
