Rectangular enclosure dimensions and cost optimization