Truncated Variance Reduction: A Unified Approach to Bayesian Optimization and Level-Set Estimation