  In this article, we study a finite horizon linear-quadratic stochastic
control problem for Brownian particles, where the cost functions depend on the
state and the occupation measure of the particles. To address this problem, we
develop an It\^o formula for the flow of occupation measure, which enables us
to derive the associated Hamilton-Jacobi-Bellman equation. Then, thanks to a
Feynman-Kac formula and the Bou\'e-Dupuis formula, we construct an optimal
strategy and an optimal trajectory. Finally, we illustrate our result when the
cost-function is the volume of the sausage associated to the particles.
