Efficient nonmyopic Bayesian optimization and quadrature