class_docstr: A BSO class, inherited from Optimizer.
  
  This is the designed class to define BSO-related
  variables and methods.
  
  References:
      Y. Shi. Brain Storm Optimization Algorithm.
      International Conference in Swarm Intelligence (2011).
class_docstr_tok: ["A","BSO","class",",","inherited","from","Optimizer",".","This","is","the","designed","class","to","define","BSO-related","variables","and","methods",".","References",":","Y.","Shi",".","Brain","Storm","Optimization","Algorithm",".","International","Conference","in","Swarm","Intelligence","(","2011",")","."]
docstr: Wraps Brain Storm 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: Number of iterations.s
docstr_tok: ["Wraps","Brain","Storm","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",":","Number","of","iterations.s"]
code: def update(
      self,
      space: Space,
      function: Function,
      iteration: int,
      n_iterations: int,
  ) -> None:
      """Wraps Brain Storm 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: Number of iterations.s
  
      """
  
      ideas_idx_per_cluster, best_idx_per_cluster = self._clusterize(
          space.agents
      )
  
      r1 = r.generate_uniform_random_number()
      if r1 < self.p_replacement_cluster:
          c = r.generate_integer_random_number(0, self.m)
          space.agents[best_idx_per_cluster[c]].fill_with_uniform()
  
      for agent in space.agents:
          a = copy.deepcopy(agent)
  
          r2 = r.generate_uniform_random_number()
          if r2 < self.p_single_cluster:
              c = r.generate_integer_random_number(0, self.m)
              if len(ideas_idx_per_cluster[c]) > 0:
                  r3 = r.generate_uniform_random_number()
                  if r3 < self.p_single_best:
                      a.position = copy.deepcopy(
                          space.agents[best_idx_per_cluster[c]].position
                      )
                  else:
                      j = r.generate_integer_random_number(
                          0, len(ideas_idx_per_cluster[c])
                      )
  
                      a.position = copy.deepcopy(
                          space.agents[
                              ideas_idx_per_cluster[c][j]
                          ].position
                      )
          else:
              if self.m > 1:
                  c1 = r.generate_integer_random_number(0, self.m)
                  c2 = r.generate_integer_random_number(0, self.m, c1)
  
                  if (
                      len(ideas_idx_per_cluster[c1]) > 0
                      and len(ideas_idx_per_cluster[c2]) > 0
                  ):
                      r4 = r.generate_uniform_random_number()
                      if r4 < self.p_double_best:
                          a.position = (
                              space.agents[
                                  best_idx_per_cluster[c1]
                              ].position
                              + space.agents[
                                  best_idx_per_cluster[c2]
                              ].position
                          ) / 2
                      else:
                          u = r.generate_integer_random_number(
                              0, len(ideas_idx_per_cluster[c1])
                          )
                          v = r.generate_integer_random_number(
                              0, len(ideas_idx_per_cluster[c2])
                          )
  
                          a.position = (
                              space.agents[
                                  ideas_idx_per_cluster[c1][u]
                              ].position
                              + space.agents[
                                  ideas_idx_per_cluster[c2][v]
                              ].position
                          ) / 2
  
          r5 = r.generate_uniform_random_number()
          csi = (
              self._sigmoid((0.5 * n_iterations - iteration) / self.k)
              * r5
          )
  
          a.position += csi * r.generate_gaussian_random_number()
          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, List, Optional, Tuple
  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 16 for calling the BSO obj's underlying member method code with example usage: obj.update(space, function, iteration, n_iterations) without return types