class_docstr: An AEO class, inherited from Optimizer.
  
  This is the designed class to define AEO-related
  variables and methods.
  
  References:
      W. Zhao, L. Wang and Z. Zhang.
      Artificial ecosystem-based optimization: a novel nature-inspired meta-heuristic algorithm.
      Neural Computing and Applications (2019).
class_docstr_tok: ["An","AEO","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","AEO-related","variables","and","methods",".","References",":","W.","Zhao",",","L.","Wang","and","Z.","Zhang",".","Artificial","ecosystem-based","optimization",":","a","novel","nature-inspired","meta-heuristic","algorithm",".","Neural","Computing","and","Applications","(","2019",")","."]
docstr: Wraps production and consumption updates over all
  agents and variables (eq. 1-8).
  
  Args:
      agents: List of agents.
      best_agent: Global best agent.
      function: A Function object that will be used as the objective function.
      iteration: Current iteration.
      n_iterations: Maximum number of iterations.
docstr_tok: ["Wraps","production","and","consumption","updates","over","all","agents","and","variables","(","eq",".","1-8",")",".","Args",":","agents",":","List","of","agents",".","best_agent",":","Global","best","agent",".","function",":","A","Function","object","that","will","be","used","as","the","objective","function",".","iteration",":","Current","iteration",".","n_iterations",":","Maximum","number","of","iterations","."]
code: def _update_composition(
      self,
      agents: List[Agent],
      best_agent: Agent,
      function: Function,
      iteration: int,
      n_iterations: int,
  ) -> None:
      """Wraps production and consumption updates over all
      agents and variables (eq. 1-8).
  
      Args:
          agents: List of agents.
          best_agent: Global best agent.
          function: A Function object that will be used as the objective function.
          iteration: Current iteration.
          n_iterations: Maximum number of iterations.
  
      """
  
      agents.sort(key=lambda x: x.fit, reverse=True)
      for i, agent in enumerate(agents):
          if i == 0:
              a = self._production(
                  agent, best_agent, iteration, n_iterations
              )
          else:
              r1 = r.generate_uniform_random_number()
  
              v1 = r.generate_gaussian_random_number()
              v2 = r.generate_gaussian_random_number()
  
              # Calculates the consumption factor (eq. 4)
              C = 0.5 * v1 / np.abs(v2)
  
              if r1 < 1 / 3:
                  a = self._herbivore_consumption(agent, agents[0], C)
              elif 1 / 3 <= r1 <= 2 / 3:
                  j = int(r.generate_uniform_random_number(1, i))
                  a = self._omnivore_consumption(
                      agent, agents[0], agents[j], C
                  )
              else:
                  j = int(r.generate_uniform_random_number(1, i))
                  a = self._carnivore_consumption(agent, agents[j], C)
  
          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)
  
file_path: opytimizer/opytimizer/optimizers/population/aeo.py
imports: import copy
  from typing import Any, Dict, List, Optional
  import numpy
  import opytimizer.math.random
  from opytimizer.core import Optimizer
  from opytimizer.core.agent import Agent
  from opytimizer.core.function import Function
  from opytimizer.core.space import Space
  from opytimizer.utils import logging
label_desc: Use image node_id 6 for calling the AEO obj's underlying member method code with example usage: obj._update_composition(agents, best_agent, function, iteration, n_iterations) without return types