The optimization of target production for AMS