code: def load_options_for_method(
      method, prob, domain, capital_type, options=None
  ):
      """Loads and returns the options for the problem."""
      # pylint: disable=too-many-branches
      # Both ea and ga can be used to specify evolutionary algorithms
      method = "ga" if method == "ea" else method
      # Now load options according to the case
      case_sel = (method, prob, domain.get_type())
      if case_sel == ("ga", "opt", "cartesian_product"):
          opt_options = load_options(ga_opt_args)
      elif case_sel == ("bo", "opt", "euclidean"):
          opt_options = load_options(get_all_euc_gp_bandit_args())
      elif case_sel == ("bo", "opt", "cartesian_product"):
          opt_options = load_options(get_all_cp_gp_bandit_args())
      elif (
          case_sel == ("direct", "opt", "euclidean")
          or case_sel == ("pdoo", "opt", "euclidean")
      ) and capital_type in ["return_value", "num_evals"]:
          opt_options = Namespace()
      elif case_sel == ("rand", "opt", "euclidean"):
          opt_options = load_options(euclidean_random_optimiser_args)
      elif case_sel == ("rand", "opt", "cartesian_product"):
          opt_options = load_options(cp_random_optimiser_args)
      elif case_sel == ("rand", "mfopt", "euclidean"):
          opt_options = load_options(mf_euclidean_random_optimiser_args)
      elif case_sel == ("rand", "mfopt", "cartesian_product"):
          opt_options = load_options(mf_cp_random_optimiser_args)
      elif case_sel == ("bo", "mfopt", "euclidean"):
          opt_options = load_options(get_all_mf_euc_gp_bandit_args())
      elif case_sel == ("bo", "mfopt", "cartesian_product"):
          opt_options = load_options(get_all_mf_cp_gp_bandit_args())
      elif case_sel == ("bo", "moo", "euclidean"):
          opt_options = load_options(get_all_euc_moo_gp_bandit_args())
      elif case_sel == ("bo", "moo", "cartesian_product"):
          opt_options = load_options(get_all_cp_moo_gp_bandit_args())
      elif case_sel == ("rand", "moo", "euclidean"):
          opt_options = load_options(
              euclidean_random_multiobjective_optimiser_args
          )
      elif case_sel == ("rand", "moo", "cartesian_product"):
          opt_options = load_options(
              cp_random_multiobjective_optimiser_args
          )
      else:
          _raise_load_options_not_supported_error(
              method, prob, domain.get_type(), capital_type
          )
      # Now look at any options that have been passed in already and add them to opt_options
      options = Namespace() if options is None else options
      for attr in vars(options):
          setattr(opt_options, attr, getattr(options, attr))
      # Also add capital type
      opt_options.capital_type = (
          "return_value"
          if capital_type == "num_evals"
          else capital_type
      )
      return opt_options
  
file_path: dragonfly/dragonfly/apis/api_utils.py
imports: from argparse import Namespace
  import numpy
  from ..exd.cp_domain_utils import load_config_file, get_processed_func_from_raw_func_for_cp_domain_fidelity, get_processed_func_from_raw_func_for_cp_domain
  from ..exd.domains import EuclideanDomain
  from ..exd.worker_manager import MultiProcessingWorkerManager, SyntheticWorkerManager, AbstractWorkerManager
  from ..opt.ga_optimiser import ga_opt_args
  from ..opt.gp_bandit import get_all_euc_gp_bandit_args, get_all_cp_gp_bandit_args, get_all_mf_euc_gp_bandit_args, get_all_mf_cp_gp_bandit_args
  from ..opt.random_optimiser import euclidean_random_optimiser_args, mf_euclidean_random_optimiser_args, cp_random_optimiser_args, mf_cp_random_optimiser_args
  from ..opt.multiobjective_gp_bandit import get_all_euc_moo_gp_bandit_args, get_all_cp_moo_gp_bandit_args
  from ..opt.random_multiobjective_optimiser import euclidean_random_multiobjective_optimiser_args, cp_random_multiobjective_optimiser_args
  from ..utils.general_utils import map_to_bounds
  from ..utils.option_handler import load_options
label_desc: Use image node_id 3 for calling a global function with example usage: load_options_for_method(method, prob, domain, capital_type, options) and returns: opt_options