class_docstr: A GOA class, inherited from Optimizer.
  
  This is the designed class to define GOA-related
  variables and methods.
  
  References:
      S. Saremi, S. Mirjalili and A. Lewis. Grasshopper Optimisation Algorithm: Theory and application.
      Advances in Engineering Software (2017).
docstr: Wraps Grasshopper Optimization Algorithm over all agents and variables.
  
  Args:
      space: Space containing agents and update-related information.
      function: A Function object that will be used as the objective function.
      iteration: Current iteration.
      n_iterations: Maximum number of iterations.
docstr_tok: ["Wraps","Grasshopper","Optimization","Algorithm","over","all","agents","and","variables",".","Args",":","space",":","Space","containing","agents","and","update-related","information",".","function",":","A","Function","object","that","will","be","used","as","the","objective","function",".","iteration",":","Current","iteration",".","n_iterations",":","Maximum","number","of","iterations","."]
code: def update(
      self,
      space: Space,
      function: Function,
      iteration: int,
      n_iterations: int,
  ) -> None:
      """Wraps Grasshopper Optimization Algorithm over all agents and variables.
  
      Args:
          space: Space containing agents and update-related information.
          function: A Function object that will be used as the objective function.
          iteration: Current iteration.
          n_iterations: Maximum number of iterations.
  
      """
  
      # Calculates the comfort coefficient (eq. 2.8)
      comfort = self.c_max - iteration * (
          (self.c_max - self.c_min) / n_iterations
      )
  
      temp_agents = copy.deepcopy(space.agents)
  
      for agent in space.agents:
          total_comfort = np.zeros(
              (agent.n_variables, agent.n_dimensions)
          )
  
          for temp in temp_agents:
              distance = g.euclidean_distance(
                  agent.position, temp.position
              )
              unit = (temp.position - agent.position) / (
                  distance + c.EPSILON
              )
  
              s = self._social_force(2 + np.fmod(distance, 2))
  
              ub = np.expand_dims(agent.ub, -1)
              lb = np.expand_dims(agent.lb, -1)
  
              total_comfort += comfort * ((ub - lb) / 2) * s * unit
  
          # Updates the agent's position (eq. 2.7)
          agent.position = (
              comfort * total_comfort + space.best_agent.position
          )
          agent.clip_by_bound()
  
          agent.fit = function(agent.position)
  
imports: import copy
  from typing import Any, Dict, Optional
  import numpy
  import opytimizer.math.general
  import opytimizer.utils.constant
  import opytimizer.utils.exception
  from opytimizer.core import Optimizer
  from opytimizer.core.function import Function
  from opytimizer.core.space import Space
  from opytimizer.utils import logging
label_desc: Use image node_id 11 for calling the GOA obj's underlying member method code with example usage: obj.update(space, function, iteration, n_iterations) without return types