Optimization and Machine Learning Training Algorithms for Fitting Numerical Physics Models