code: def test_af_compile():
      search_space = search.SearchSpace(
          n_agents=10,
          n_variables=2,
          lower_bound=[0, 0],
          upper_bound=[10, 10],
      )
  
      new_af = af.AF()
      new_af.compile(search_space)
  
      try:
          new_af.p_distance = 1
      except:
          new_af.p_distance = np.array([1])
  
      assert new_af.p_distance == np.array([1])
  
      try:
          new_af.g_distance = 1
      except:
          new_af.g_distance = np.array([1])
  
      assert new_af.g_distance == np.array([1])
  
imports: import numpy
  from opytimizer.optimizers.swarm import af
  from opytimizer.spaces import search
label_desc: Use image node_id 3 for calling a global function with example usage: test_af_compile() without return types