Optimization of the Locations of Virtual Network Functions