Data-driven control of airborne infection risk and energy use in buildings