Influenza is a serious public health concern and vaccination is the first line of defense. In a pandemic, individuals are prioritized based on their risk profiles and transmission rates to ensure effective use of the available vaccine. We use an agent-based stochastic simulation model, and optimize the age-specific vaccine distribution strategy. We use black-box optimization techniques to minimize the overall cost of the outbreak. Our numerical experiments show that the best policy returned by our approach outperforms alternative policies recommended by the Advisory Committee on Immunization Practices and Centers for Disease Control and Prevention.