On optimal design of half-wave resonators for acoustic damping in an enclosure