Efficient nonmyopic active search with applications in drug and materials discovery