code: def run_example(FLAGS):
      """
      Run parallel Sherpa optimization over a set of discrete hp combinations.
      """
      # Iterate algorithm accepts dictionary containing lists of possible values.
      hp_space = {
          "act": ["tanh", "relu"],
          "lrinit": [0.1, 0.01],
          "momentum": [0.0],
          "lrdecay": [0.0],
          "arch": [[20, 5], [20, 10], [10, 10, 10]],
          "epochs": [20],
      }
      parameters = sherpa.Parameter.grid(hp_space)
  
      alg = sherpa.algorithms.GridSearch()
      stopping_rule = sherpa.algorithms.MedianStoppingRule(
          min_iterations=10, min_trials=5
      )
      f = "./bianchini.py"  # Python script to run.
      dir = "./output"  # All files written to here.
  
      if not FLAGS.local:
          # Submit to SGE queue.
          # env = '/home/pjsadows/profiles/auto.profile'  # Script specifying environment variables.
          env = FLAGS.env
          opt = "-N example -P {} -q {} -l {}".format(
              FLAGS.P, FLAGS.q, FLAGS.l
          )
          sched = SGEScheduler(
              environment=env, submit_options=opt, output_dir=dir
          )
      else:
          # Run on local machine.
          sched = LocalScheduler()  # Run on local machine without SGE.
  
      rval = sherpa.optimize(
          parameters=parameters,
          algorithm=alg,
          stopping_rule=stopping_rule,
          output_dir=dir,
          lower_is_better=True,
          filename=f,
          scheduler=sched,
          max_concurrent=FLAGS.max_concurrent,
      )
      print()
      print("Best results:")
      print(rval)
  
imports: import os
  import argparse
  import sherpa
  from sherpa.schedulers import LocalScheduler, SGEScheduler
label_desc: Use image node_id 1 for calling a global function with example usage: run_example(FLAGS) without return types