code: def test_random_search_optimizer(self):
      torch.manual_seed(1)
      input_dim = 3
      num_initial = 5
      tkwargs = {"device": self.device}
      optimizer_kwargs = {
          "pop_size": 1000,
          "max_tries": 5,
      }
  
      for (
          dtype,
          maximize,
          num_objectives,
          use_model_list,
          standardize_model,
      ) in product(
          (torch.float, torch.double),
          (True, False),
          (1, 2),
          (False, True),
          (False, True),
      ):
          tkwargs["dtype"] = dtype
          num_points = num_objectives
  
          model, X, Y = get_model(
              num_points=num_initial,
              input_dim=input_dim,
              num_objectives=num_objectives,
              use_model_list=use_model_list,
              standardize_model=standardize_model,
              **tkwargs,
          )
  
          model_sample = get_gp_samples(
              model=model,
              num_outputs=num_objectives,
              n_samples=1,
          )
  
          input_dim = X.shape[-1]
          # fake bounds
          bounds = torch.zeros((2, input_dim), **tkwargs)
          bounds[1] = 1.0
  
          pareto_set, pareto_front = random_search_optimizer(
              model=model_sample,
              bounds=bounds,
              num_points=num_points,
              maximize=maximize,
              **optimizer_kwargs,
          )
  
          # check shape
          self.assertTrue(pareto_set.ndim == 2)
          self.assertTrue(pareto_front.ndim == 2)
          self.assertTrue(pareto_set.shape[-1] == X.shape[-1])
          self.assertTrue(pareto_front.shape[-1] == Y.shape[-1])
          self.assertTrue(
              pareto_front.shape[-2] == pareto_set.shape[-2]
          )
          num_optimal_points = pareto_front.shape[-2]
  
          # check if samples are non-dominated
          weight = 1.0 if maximize else -1.0
          count = torch.sum(is_non_dominated(Y=weight * pareto_front))
          self.assertTrue(count == num_optimal_points)
  
      # Ask for more optimal points than query evaluations
      with self.assertRaises(RuntimeError):
          random_search_optimizer(
              model=model_sample,
              bounds=bounds,
              num_points=20,
              maximize=maximize,
              max_tries=1,
              pop_size=10,
          )
  
imports: import warnings
  from itertools import product
  from unittest import mock
  import torch
  from botorch.acquisition.multi_objective.objective import MCMultiOutputObjective, UnstandardizeMCMultiOutputObjective
  from botorch.acquisition.multi_objective.utils import compute_sample_box_decomposition, get_default_partitioning_alpha, prune_inferior_points_multi_objective, random_search_optimizer, sample_optimal_points
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.transforms.outcome import Standardize
  from botorch.utils.gp_sampling import get_gp_samples
  from botorch.utils.multi_objective import is_non_dominated
  from botorch.utils.testing import BotorchTestCase, MockModel, MockPosterior
  from torch import Tensor
label_desc: Use image node_id 1 for calling the TestThompsonSampling obj's underlying member method code with example usage: obj.test_random_search_optimizer() without return types