code: def test_qEI(self):
      for double in (True, False):
          self._setUp(double=double)
          qEI = qExpectedImprovement(self.model_st, best_f=0.0)
          candidates, _ = optimize_acqf(
              acq_function=qEI,
              bounds=self.bounds,
              q=3,
              num_restarts=10,
              raw_samples=20,
              options={"maxiter": 5},
          )
          self.assertTrue(torch.all(-EPS <= candidates))
          self.assertTrue(torch.all(candidates <= 1 + EPS))
          qEI = qExpectedImprovement(self.model_fn, best_f=0.0)
          candidates, _ = optimize_acqf(
              acq_function=qEI,
              bounds=self.bounds,
              q=3,
              num_restarts=10,
              raw_samples=20,
              options={"maxiter": 5},
          )
          self.assertTrue(torch.all(-EPS <= candidates))
          self.assertTrue(torch.all(candidates <= 1 + EPS))
          candidates_batch_limit, _ = optimize_acqf(
              acq_function=qEI,
              bounds=self.bounds,
              q=3,
              num_restarts=10,
              raw_samples=20,
              options={"maxiter": 5, "batch_limit": 5},
          )
          self.assertTrue(torch.all(-EPS <= candidates_batch_limit))
          self.assertTrue(torch.all(candidates_batch_limit <= 1 + EPS))
  
file_path: botorch/test/test_end_to_end.py
imports: import math
  import warnings
  import torch
  from botorch.acquisition import ExpectedImprovement, qExpectedImprovement
  from botorch.exceptions.warnings import OptimizationWarning
  from botorch.fit import fit_gpytorch_mll
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.optim import optimize_acqf
  from botorch.utils.testing import BotorchTestCase
  from gpytorch.mlls.exact_marginal_log_likelihood import ExactMarginalLogLikelihood
label_desc: Use image node_id 2 for calling the TestEndToEnd obj's underlying member method code with example usage: obj.test_qEI() without return types