Convex Optimization of the Basic Reproduction Number