class_docstr: An HGSO class, inherited from Optimizer.
  
  This is the designed class to define HGSO-related
  variables and methods.
  
  References:
      F. Hashim et al. Henry gas solubility optimization: A novel physics-based algorithm.
      Future Generation Computer Systems (2019).
class_docstr_tok: ["An","HGSO","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","HGSO-related","variables","and","methods",".","References",":","F.","Hashim","et","al",".","Henry","gas","solubility","optimization",":","A","novel","physics-based","algorithm",".","Future","Generation","Computer","Systems","(","2019",")","."]
docstr: Wraps Henry Gas Solubility 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","Henry","Gas","Solubility","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 Henry Gas Solubility 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.
  
      """
  
      clusters = g.n_wise(space.agents, self.pressure.shape[1])
      for i, cluster in enumerate(clusters):
          # Calculates the system's current temperature (eq. 8)
          T = np.exp(-iteration / n_iterations)
  
          # Updates Henry's coefficient (eq. 8)
          self.coefficient[i] *= np.exp(
              -self.constant[i] * (1 / T - 1 / 298.15)
          )
  
          cluster = list(cluster)
          cluster.sort(key=lambda x: x.fit)
  
          for j, agent in enumerate(cluster):
              # Calculates agent's solubility (eq. 9)
              solubility = (
                  self.K * self.coefficient[i] * self.pressure[i][j]
              )
  
              # Updates agent's position (eq. 10)
              agent.position = self._update_position(
                  agent, cluster[0], space.best_agent, solubility
              )
              agent.clip_by_bound()
  
              agent.fit = function(agent.position)
  
      space.agents.sort(key=lambda x: x.fit)
  
      # Calculates the number of worst agents (eq. 11)
      r1 = r.generate_uniform_random_number()
      N = int(len(space.agents) * (r1 * (0.2 - 0.1) + 0.1))
  
      for agent in space.agents[-N:]:
          # Updates bad agent's position (eq. 12)
          r2 = r.generate_uniform_random_number()
          agent.position = agent.lb + r2 * (agent.ub - agent.lb)
  
imports: from typing import Any, Dict, Optional
  import numpy
  import opytimizer.math.general
  import opytimizer.math.random
  import opytimizer.utils.exception
  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 24 for calling the HGSO obj's underlying member method code with example usage: obj.update(space, function, iteration, n_iterations) without return types