code: def __init__(self, variables, grid_size):
      self.variables = []
      self.cardinality = 0
  
      # Count the total number of dimensions and roll into new format.
      for variable in variables:
          self.cardinality += variable.size
  
          if variable.type == "int":
              self.variables.append(
                  {
                      "name": variable.name,
                      "size": variable.size,
                      "type": "int",
                      "min": int(variable.range[0]),
                      "max": int(variable.range[1]),
                  }
              )
  
          elif variable.type == "float":
              self.variables.append(
                  {
                      "name": variable.name,
                      "size": variable.size,
                      "type": "float",
                      "min": float(variable.range[0]),
                      "max": float(variable.range[1]),
                  }
              )
  
          elif variable.type == "enum":
              self.variables.append(
                  {
                      "name": variable.name,
                      "size": variable.size,
                      "type": "enum",
                      "options": variable.range,
                  }
              )
          else:
              raise Exception("Unknown parameter type.")
      log("Optimizing over %d dimensions\n" % (self.cardinality))
  
imports: import os
  import sys
  import tempfile
  import pickle
  import numpy
  import numpy.random
  from .spearmint_pb2 import *
  from .Locker import *
  from .sobol_lib import *
  from .helpers import *
  import logging
label_desc: Use image node_id 1 to create a new GridMap object  with example: obj = GridMap(variables, grid_size)