Smoothed aggregation with energy minimization