code: def test_nevergrad_optimizer_discrete(self):
      batch_size = 32
      n_generations = 40
      input_param = discrete_input_param()
      gt_net = create_ground_truth_net(input_param)
      obj_func = create_discrete_choice_obj_func(input_param, gt_net)
      optimizer = NeverGradOptimizer(
          input_param,
          batch_size * n_generations,  # estimated_budgets
          obj_func=obj_func,
          batch_size=batch_size,
          optimizer_name="DoubleFastGADiscreteOnePlusOne",
      )
      best_rs_result = random_sample(
          input_param, obj_func, n_generations=20
      )
      history_min_reward = torch.tensor(9999.0)
      for i in range(n_generations):
          (
              sampled_solutions,
              reward,
          ) = optimizer.optimize_step()
          history_min_reward = torch.min(
              history_min_reward, torch.min(reward.data)
          )
          print(
              f"Generation={i}, min_reward={torch.min(reward.data)}, "
              f"history_min_reward={history_min_reward}"
          )
      assert (
          abs(best_rs_result - history_min_reward)
          < NEVERGRAD_TEST_THRES
      ), f"Learning not converged. best random search={best_rs_result}, optimizer best result={history_min_reward}"
      assert (
          optimizer.best_solutions(1)[0][0] == history_min_reward
      ), "Best solutions (n=1) inconsistent with the best reward"
      # just test sampling() can run
      optimizer.sample(10)
  
imports: import random
  import unittest
  from collections import defaultdict
  from typing import Dict
  import nevergrad
  import numpy
  import torch
  import torch.nn
  from reagent.lite.optimizer import BayesianByBackpropOptimizer, BayesianMLPEnsemblerOptimizer, BayesianOptimizerBase, GREEDY_TEMP, GumbelSoftmaxOptimizer, NeverGradOptimizer, PolicyGradientOptimizer, QLearningOptimizer, RandomSearchOptimizer, sol_to_tensors
label_desc: Use image node_id 5 for calling the TestComboOptimizer obj's underlying member method code with example usage: obj.test_nevergrad_optimizer_discrete() without return types