A measure theoretic approach to traffic flow optimization on networks