Design and Optimization of Networks With Dynamic Routing