A model coupling differential equations and a sequence of constrained optimization problems is proposed to simulate the evolution of a population of particles at equilibrium interacting through a common medium. The first order optimality conditions of the optimization problems relaxed with barrier functions are coupled with the differential equations into a system of differential-algebraic equa...