class_docstr: A WEO class, inherited from Optimizer.
  
  This is the designed class to define WEO-related
  variables and methods.
  
  References:
      A. Kaveh and T. Bakhshpoori.
      Water Evaporation Optimization: A novel physically inspired optimization algorithm.
      Computers & Structures (2016).
docstr: Wraps Water Evaporation Optimization 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","Water","Evaporation","Optimization","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 Water Evaporation Optimization 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.
  
      """
  
      space.agents.sort(key=lambda x: x.fit)
      best, worst = space.agents[0], space.agents[-1]
  
      for agent in space.agents:
          a = copy.deepcopy(agent)
  
          if int(iteration <= n_iterations / 2):
              # Calculates the substrate energy (eq. 5)
              E_sub = (
                  (self.E_max - self.E_min) * (a.fit - best.fit)
              ) / (worst.fit - best.fit + c.EPSILON) + self.E_min
  
              # Calculates the Monolayer Evaporation Probability matrix (eq. 6)
              r1 = r.generate_uniform_random_number(
                  size=(agent.n_variables, agent.n_dimensions)
              )
              MEP = np.where(r1 < np.exp(E_sub), 1, 0)
  
              # Generates the step size (eq. 10)
              r2 = r.generate_uniform_random_number()
              i = r.generate_integer_random_number(0, space.n_agents)
              j = r.generate_integer_random_number(0, space.n_agents, i)
              S = r2 * (
                  space.agents[i].position - space.agents[j].position
              )
  
              # Updates the agent's position (eq. 11)
              a.position += S * MEP
          else:
              # Calculates the contact angle (eq. 8)
              theta = (
                  (self.theta_max - self.theta_min) * (a.fit - best.fit)
              ) / (worst.fit - best.fit + c.EPSILON) + self.theta_min
  
              # Calculates the Droplet Evaporation Probability matrix (eq. 9)
              r1 = r.generate_uniform_random_number(
                  size=(a.n_variables, a.n_dimensions)
              )
              DEP = np.where(r1 < self._evaporation_flux(theta), 1, 0)
  
              # Generates the step size (eq. 10)
              r2 = r.generate_uniform_random_number()
              i = r.generate_integer_random_number(0, space.n_agents)
              j = r.generate_integer_random_number(0, space.n_agents, i)
              S = r2 * (
                  space.agents[i].position - space.agents[j].position
              )
  
              # Updates the agent's position (eq. 11)
              a.position += S * DEP
          a.clip_by_bound()
  
          a.fit = function(a.position)
          if a.fit < agent.fit:
              agent.position = copy.deepcopy(a.position)
              agent.fit = copy.deepcopy(a.fit)
  
imports: import copy
  from typing import Any, Dict, Optional
  import numpy
  import opytimizer.math.random
  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 WEO obj's underlying member method code with example usage: obj.update(space, function, iteration, n_iterations) without return types