Optimization of control strategies for epidemics in heterogeneous populations with symmetric and asymmetric transmission.