code: def compute_best_reward(input_cities):
      batch_size, candidate_num, _ = input_cities.shape
      all_perm = torch.tensor(
          list(permutations(torch.arange(candidate_num), candidate_num))
      )
      res = [
          compute_reward(
              gather(input_cities, perm.repeat(batch_size, 1))
          )
          for perm in all_perm
      ]
      # res shape: batch_size, num_perm
      res = torch.cat(res, dim=1)
      best_possible_reward = torch.min(res, dim=1).values
      best_possible_reward_mean = torch.mean(best_possible_reward)
      return best_possible_reward_mean
  
imports: import logging
  import math
  import tempfile
  from itertools import permutations
  import pytorch_lightning
  import reagent.core.types
  import torch
  import torch.nn
  from reagent.core.parameters import Seq2SlateParameters
  from reagent.core.parameters_seq2slate import LearningMethod, SimulationParameters
  from reagent.core.torch_utils import gather
  from reagent.model_utils.seq2slate_utils import Seq2SlateOutputArch
  from reagent.models.seq2slate import Seq2SlateMode, Seq2SlateTransformerNet
  from reagent.optimizer.union import Optimizer__Union
  from reagent.training.ranking.seq2slate_sim_trainer import Seq2SlateSimulationTrainer
  from reagent.training.ranking.seq2slate_trainer import Seq2SlateTrainer
  from torch.utils.data import DataLoader
label_desc: Use image node_id 7 for calling a global function with example usage: compute_best_reward(input_cities) and returns: best_possible_reward_mean