Final code L-BFGS-B-NS optimizer