Optimal assignment of traffic flows