class_docstr: A TEO class, inherited from Optimizer.
  
  This is the designed class to define TEO-related
  variables and methods.
  
  References:
      A. Kaveh and A. Dadras. A novel meta-heuristic optimization algorithm: Thermal exchange optimization.
      Advances in Engineering Software (2017).
class_docstr_tok: ["A","TEO","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","TEO-related","variables","and","methods",".","References",":","A.","Kaveh","and","A.","Dadras",".","A","novel","meta-heuristic","optimization","algorithm",":","Thermal","exchange","optimization",".","Advances","in","Engineering","Software","(","2017",")","."]
docstr: Wraps Thermal Exchange Optimization over all agents and variables.
  
  Args:
      space: Space containing agents and update-related information.
      iteration: Current iteration.
      n_iterations: Maximum number of iterations.
docstr_tok: ["Wraps","Thermal","Exchange","Optimization","over","all","agents","and","variables",".","Args",":","space",":","Space","containing","agents","and","update-related","information",".","iteration",":","Current","iteration",".","n_iterations",":","Maximum","number","of","iterations","."]
code: def update(
      self, space: Space, iteration: int, n_iterations: int
  ) -> None:
      """Wraps Thermal Exchange Optimization over all agents and variables.
  
      Args:
          space: Space containing agents and update-related information.
          iteration: Current iteration.
          n_iterations: Maximum number of iterations.
  
      """
  
      space.agents.sort(key=lambda x: x.fit)
  
      self.TM.append(copy.deepcopy(space.agents[0]))
      self.TM = self.TM[-self.n_TM :]
  
      space.agents = space.agents[: -len(self.TM)] + self.TM
      space.agents.sort(key=lambda x: x.fit)
  
      # Calculates the time (eq. 9)
      time = iteration / n_iterations
  
      for env in self.environment:
          # Updates the environment's position (eq. 10)
          r1 = r.generate_uniform_random_number()
          env.position = (
              1 - (self.c1 + self.c2 * (1 - time)) * r1 * env.position
          )
  
      for agent, env in zip(space.agents, self.environment):
          # Calculates the agent's beta value (eq. 8)
          beta = agent.fit / space.agents[-1].fit
  
          # Updates the agent's position (eq. 11)
          agent.position = env.position + (
              agent.position - env.position
          ) * np.exp(-beta * time)
  
          r1 = r.generate_uniform_random_number()
          if r1 < self.pro:
              idx = r.generate_integer_random_number(
                  high=agent.n_variables
              )
  
              # Resets its position (eq. 12)
              r2 = r.generate_uniform_random_number()
              agent.position[idx] = agent.lb[idx] + r2 * (
                  agent.ub[idx] - agent.lb[idx]
              )
  
imports: import copy
  from typing import Any, Dict, List, Optional
  import numpy
  import opytimizer.math.random
  import opytimizer.utils.exception
  from opytimizer.core import Optimizer
  from opytimizer.core.agent import Agent
  from opytimizer.core.space import Space
  from opytimizer.utils import logging
label_desc: Use image node_id 15 for calling the TEO obj's underlying member method code with example usage: obj.update(space, iteration, n_iterations) without return types