code: def generate_unique_combinations(
      built_permutation,
      remaining_columns,
      full_permutation_list,
      group_width,
  ):
      # base case: nothing else to add
      if len(remaining_columns) == 0:
          full_permutation_list.append(np.copy(built_permutation))
          if len(full_permutation_list) % 1000000 == 0:
              print(
                  f"{len(full_permutation_list)} unique permutations found so far"
              )
  
      # still more choices to make, so add each remaining column in turn column if it keeps everything sorted
      else:
          for c in range(len(remaining_columns)):
              # to satisfy our immutables (values within groups are sorted, groups are globally sorted),
              # only add this column if either:
              #   it's starting a new group and is larger than the previous group's first entry
              #   OR
              #   it's larger than the last value in the built_permutation
              col_to_add = remaining_columns[c]
  
              if is_canonical(built_permutation, col_to_add):
                  # add the column to the running permutation, remove it from remaining columns
                  built_permutation.append(col_to_add)
                  remaining_columns.pop(c)
                  # recurse
                  generate_unique_combinations(
                      built_permutation,
                      remaining_columns,
                      full_permutation_list,
                      group_width,
                  )
                  # remove the most recent column and put it back on the remaining column list where we found it (sorted)
                  remaining_columns.insert(c, built_permutation.pop(-1))
  
file_path: apex/apex/contrib/sparsity/permutation_search_kernels/exhaustive_search.py
imports: from .permutation_utilities import *
  import pickle
  import os.path
  from os import path
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: generate_unique_combinations(built_permutation, remaining_columns, full_permutation_list, group_width) without return types