code: def main():
      """Main function."""
      # Make directories
      if os.path.exists(TMP_DIR):
          shutil.rmtree(TMP_DIR)
      if os.path.exists(EXP_DIR):
          shutil.rmtree(EXP_DIR)
      os.mkdir(TMP_DIR)
      os.mkdir(EXP_DIR)
      # Obtain a reporter
      reporter = get_reporter(
          open(LOG_FILE, "w")
      )  # Writes to file log_mlp
  
      # First, obtain a function caller: A function_caller is used to evaluate a function
      # defined on a given domain (and a fidelity space). The train_params
      # can be used to specify additional training parameters such as the batch size etc.
      if DATASET == "cifar10":
          # We have defined the CNNFunctionCaller in cnn_function_caller.py.
          train_params = Namespace(data_dir=CIFAR_DATA_DIR)
          func_caller = CNNFunctionCaller(
              CNN_CONFIG_FILE,
              train_params,
              reporter=reporter,
              tmp_dir=TMP_DIR,
          )
      else:
          # We have defined the MLPFunctionCaller in mlp_function_caller.py.
          train_params = Namespace(
              data_train_file=get_train_file_name(DATASET)
          )
          func_caller = MLPFunctionCaller(
              MLP_CONFIG_FILE,
              train_params,
              reporter=reporter,
              tmp_dir=TMP_DIR,
          )
      # Obtain a worker manager: A worker manager (defined in opt/worker_manager.py) is used
      # to manage (possibly) multiple workers. For a MultiProcessingWorkerManager,
      # the budget should be given in wall clock seconds.
      worker_manager = MultiProcessingWorkerManager(GPU_IDS, EXP_DIR)
  
      # Run the optimiser
      opt_val, opt_point, _ = bo_from_func_caller(
          func_caller,
          worker_manager,
          BUDGET,
          is_mf=True,
          reporter=reporter,
      )
      # Convert to "raw" format
      raw_opt_point = func_caller.get_raw_domain_point_from_processed(
          opt_point
      )
      opt_nn = raw_opt_point[
          0
      ]  # Because first index in the config file is the neural net.
  
      # Print the optimal value and visualise the best network.
      reporter.writeln("\nOptimum value found: %0.5f" % (opt_val))
      if visualise_nn is not None:
          visualise_file = os.path.join(EXP_DIR, "optimal_network")
          reporter.writeln(
              "Optimal network visualised in %s.eps." % (visualise_file)
          )
          visualise_nn(opt_nn, visualise_file)
      else:
          reporter.writeln(
              "Install graphviz (pip install graphviz) to visualise the network."
          )
  
file_path: dragonfly/examples/nas/demo_nas.py
imports: from __future__ import print_function
  from argparse import Namespace
  import time
  import os
  import shutil
  from mlp_function_caller import MLPFunctionCaller
  from dragonfly.opt.gp_bandit import bo_from_func_caller
  from dragonfly.exd.worker_manager import MultiProcessingWorkerManager
  from dragonfly.utils.reporters import get_reporter
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types