original_docstring: 
          The main operations (equations) of algorithm. Inherit from Optimizer class
  
          Args:
              epoch (int): The current iteration
          
docstring: The main operations (equations) of algorithm. Inherit from Optimizer class
docstring_tokens: The main operations ( equations ) of algorithm . Inherit from Optimizer class
code: def evolve(self, epoch):
          """
          The main operations (equations) of algorithm. Inherit from Optimizer class
  
          Args:
              epoch (int): The current iteration
          """
          nfe_epoch = 0
          fit_list = np.array([agent[self.ID_TAR][self.ID_FIT] for agent in self.pop])
          fit_list = sorted(fit_list)
  
          pop_new = []
          for idx in range(0, self.pop_size):
              si = self.max_sparks * (fit_list[-1] - self.pop[idx][self.ID_TAR][self.ID_FIT] + self.EPSILON) / \
                   (self.pop_size * fit_list[-1] - np.sum(fit_list) + self.EPSILON)
              Ai = self.max_ea * (self.pop[idx][self.ID_TAR][self.ID_FIT] - fit_list[0] + self.EPSILON) / \
                   (np.sum(fit_list) - fit_list[0] + self.EPSILON)
              if si < self.p_a * self.max_sparks:
                  si_ = int(round(self.p_a * self.max_sparks) + 1)
              elif si > self.p_b * self.m_sparks:
                  si_ = int(round(self.p_b * self.max_sparks) + 1)
              else:
                  si_ = int(round(si) + 1)
  
              ## Algorithm 1
              pop_new = []
              for j in range(0, si_):
                  pos_new = deepcopy(self.pop[idx][self.ID_POS])
                  list_idx = np.random.choice(range(0, self.problem.n_dims), round(np.random.uniform() * self.problem.n_dims), replace=False)
                  displacement = Ai * np.random.uniform(-1, 1)
                  pos_new[list_idx] = pos_new[list_idx] + displacement
                  pos_new = np.where(np.logical_or(pos_new < self.problem.lb, pos_new > self.problem.ub),
                                     self.problem.lb + np.abs(pos_new) % (self.problem.ub - self.problem.lb), pos_new)
                  pos_new = self.amend_position(pos_new, self.problem.lb, self.problem.ub)
                  pop_new.append([pos_new, None])
                  nfe_epoch += 1
              pop_new = self.update_target_wrapper_population(pop_new)
  
          for _ in range(0, self.m_sparks):
              idx = np.random.randint(0, self.pop_size)
              pos_new = deepcopy(self.pop[idx][self.ID_POS])
              list_idx = np.random.choice(range(0, self.problem.n_dims), round(np.random.uniform() * self.problem.n_dims), replace=False)
              pos_new[list_idx] = pos_new[list_idx] + np.random.normal(0, 1)  # Gaussian
              pos_new = np.where(np.logical_or(pos_new < self.problem.lb, pos_new > self.problem.ub), self.problem.lb + \
                                 np.abs(pos_new) % (self.problem.ub - self.problem.lb), pos_new)
              pos_new = self.amend_position(pos_new, self.problem.lb, self.problem.ub)
              pop_new.append([pos_new, None])
              nfe_epoch += 1
          pop_new = self.update_target_wrapper_population(pop_new)
  
          ## Update the global best
          self.pop = self.get_sorted_strim_population(pop_new + self.pop, self.pop_size)
code_tokens: def evolve ( self , epoch ) : nfe_epoch = 0 fit_list = np . array ( [ agent [ self . ID_TAR ] [ self . ID_FIT ] for agent in self . pop ] ) fit_list = sorted ( fit_list ) pop_new = [ ] for idx in range ( 0 , self . pop_size ) : si = self . max_sparks * ( fit_list [ - 1 ] - self . pop [ idx ] [ self . ID_TAR ] [ self . ID_FIT ] + self . EPSILON ) / ( self . pop_size * fit_list [ - 1 ] - np . sum ( fit_list ) + self . EPSILON ) Ai = self . max_ea * ( self . pop [ idx ] [ self . ID_TAR ] [ self . ID_FIT ] - fit_list [ 0 ] + self . EPSILON ) / ( np . sum ( fit_list ) - fit_list [ 0 ] + self . EPSILON ) if si < self . p_a * self . max_sparks : si_ = int ( round ( self . p_a * self . max_sparks ) + 1 ) elif si > self . p_b * self . m_sparks : si_ = int ( round ( self . p_b * self . max_sparks ) + 1 ) else : si_ = int ( round ( si ) + 1 ) pop_new = [ ] for j in range ( 0 , si_ ) : pos_new = deepcopy ( self . pop [ idx ] [ self . ID_POS ] ) list_idx = np . random . choice ( range ( 0 , self . problem . n_dims ) , round ( np . random . uniform ( ) * self . problem . n_dims ) , replace = False ) displacement = Ai * np . random . uniform ( - 1 , 1 ) pos_new [ list_idx ] = pos_new [ list_idx ] + displacement pos_new = np . where ( np . logical_or ( pos_new < self . problem . lb , pos_new > self . problem . ub ) , self . problem . lb + np . abs ( pos_new ) % ( self . problem . ub - self . problem . lb ) , pos_new ) pos_new = self . amend_position ( pos_new , self . problem . lb , self . problem . ub ) pop_new . append ( [ pos_new , None ] ) nfe_epoch += 1 pop_new = self . update_target_wrapper_population ( pop_new ) for _ in range ( 0 , self . m_sparks ) : idx = np . random . randint ( 0 , self . pop_size ) pos_new = deepcopy ( self . pop [ idx ] [ self . ID_POS ] ) list_idx = np . random . choice ( range ( 0 , self . problem . n_dims ) , round ( np . random . uniform ( ) * self . problem . n_dims ) , replace = False ) pos_new [ list_idx ] = pos_new [ list_idx ] + np . random . normal ( 0 , 1 ) pos_new = np . where ( np . logical_or ( pos_new < self . problem . lb , pos_new > self . problem . ub ) , self . problem . lb + np . abs ( pos_new ) % ( self . problem . ub - self . problem . lb ) , pos_new ) pos_new = self . amend_position ( pos_new , self . problem . lb , self . problem . ub ) pop_new . append ( [ pos_new , None ] ) nfe_epoch += 1 pop_new = self . update_target_wrapper_population ( pop_new ) self . pop = self . get_sorted_strim_population ( pop_new + self . pop , self . pop_size )
short_docstring: The main operations (equations) of algorithm.
short_docstring_tokens: The main operations ( equations ) of algorithm .
comment: """
          The main operations (equations) of algorithm. Inherit from Optimizer class
  
          Args:
              epoch (int): The current iteration
          """$SEP$## Algorithm 1$SEP$# Gaussian$SEP$## Update the global best