class_docstr: Unit tests for GA optimiser on cartesian product spaces. 
class_docstr_tok: ["Unit","tests","for","GA","optimiser","on","cartesian","product","spaces","."]
docstr: Testing GA optimiser with ask tell interface. 
docstr_tok: ["Testing","GA","optimiser","with","ask","tell","interface","."]
code: def test_ask_tell(self):
      """Testing GA optimiser with ask tell interface."""
      self.report(
          "Testing %s using the ask-tell interface." % (type(self))
      )
  
      domain, orderings = load_cp_domain_from_config_file(
          "dragonfly/test_data/park1_3/config.json"
      )
  
      def evaluate(x):
          return park1_3(x)
  
      func_caller = CPFunctionCaller(
          None, domain, domain_orderings=orderings
      )
      opt = cp_ga_optimiser.CPGAOptimiser(
          func_caller, ask_tell_mode=True
      )
      opt.initialise()
  
      best_x, best_y = None, float("-inf")
      for _ in range(60):
          x = opt.ask()
          y = evaluate(x)
          opt.tell([(x, y)])
          self.report("x: %s, y: %s" % (x, y))
          if y > best_y:
              best_x, best_y = x, y
      self.report(
          "-----------------------------------------------------"
      )
      self.report(
          "Optimal Value: %s, Optimal Point: %s" % (best_y, best_x)
      )
  
      self.report(
          "-----------------------------------------------------"
      )
      config = load_config_file(
          "dragonfly/test_data/park1_3/config.json"
      )
      self.report("Regular optimisation using maximise_function")
      val, pt, _ = maximise_function(
          evaluate, domain, 60, opt_method="ga", config=config
      )
      self.report("Optimal Value: %s, Optimal Point: %s" % (val, pt))
  
file_path: dragonfly/dragonfly/opt/unittest_cp_ga_optimiser.py
imports: from .None import cp_ga_optimiser
  from ..apis.opt import maximise_function
  from ..exd import domains
  from ..exd.cp_domain_utils import load_cp_domain_from_config_file, load_config_file
  from ..exd.domains import CartesianProductDomain, EuclideanDomain, IntegralDomain
  from ..exd.experiment_caller import CPFunctionCaller
  from ..test_data.park1_3.park1_3 import park1_3
  from .unittest_cp_random_optimiser import CPOptimiserBaseTestCase
  from ..utils.base_test_class import BaseTestClass, execute_tests
label_desc: Use image node_id 1 for calling the CPGAOPtimiserTestCase obj's underlying member method code with example usage: obj.test_ask_tell() and returns: park1_3