Determination of the Optimal Pipe Configuration and Diameters for a District Heating System