  We consider an optimal control problem for a system of local continuity
equations on a space of probability measures. Such systems can be viewed as
macroscopic models of ensembles of non-interacting particles or homotypic
individuals, representing several different ``populations''. For the stated
problem, we propose a necessary optimality condition, which involves feedback
controls inherent to the extremal structure, designed via the standard
Pontryagin's Maximum Principle conditions. This optimality condition admits a
realization as an iterative algorithm for optimal control. As a motivating
case, we discuss an application of the derived optimality condition and the
consequent numeric method to a problem of supervised machine learning via
dynamic systems.
