Optimal Screening in Structured SIR Epidemics