code: def test_global_function_search():
      spec_F = dlib.function_spec([-10, -10], [10, 10])
      spec_G = dlib.function_spec([-2], [6])
  
      opt = dlib.global_function_search([spec_F, spec_G])
  
      for i in range(15):
          next = opt.get_next_x()
          # print("next x is for function {} and has coordinates {}".format(next.function_idx, next.x))
  
          if next.function_idx == 0:
              a = next.x[0]
              b = next.x[1]
              next.set(F(a, b))
          else:
              x = next.x[0]
              next.set(G(x))
  
      [x, y, function_idx] = opt.get_best_function_eval()
  
      # print("\nbest function was {}, with y of {}, and x of {}".format(function_idx,y,x))
  
      assert abs(y - 2) < 1e-7
      assert abs(x[0] - 5) < 1e-7
      assert function_idx == 1
  
file_path: dlib/tools/python/test/test_global_optimization.py
imports: from dlib import find_max_global, find_min_global
  import dlib
  from pytest import raises
  from math import sin, cos, pi, exp, sqrt, pow
label_desc: Use image node_id 4 for calling a global function with example usage: test_global_function_search() without return types