On Methods for Bayesian Optimization of Least-Squares Problems and Optimization of Nanophotonic Devices