original_docstring: 
      Calculate the energies of all the population members at the same time.
      Puts the best member in first place. Useful if the population has just
      been initialised.
      
docstring: Calculate the energies of all the population members at the same time.
  Puts the best member in first place. Useful if the population has just
  been initialised.
docstring_tokens: Calculate the energies of all the population members at the same time . Puts the best member in first place . Useful if the population has just been initialised .
code: def _calculate_population_energies(self):
      """
      Calculate the energies of all the population members at the same time.
      Puts the best member in first place. Useful if the population has just
      been initialised.
      """
  
      ##############
      # CHANGES: self.func operates on the entire parameters array
      ##############
      itersize = max(0, min(len(self.population),
                            self.maxfun - self._nfev + 1))
      candidates = self.population[:itersize]
      parameters = np.array([self._scale_parameters(c)
                             for c in candidates])  # TODO: can be vectorized
      energies = self.func(parameters, *self.args)
      self.population_energies = energies
      self._nfev += itersize
  
      # for index, candidate in enumerate(self.population):
      #     if self._nfev > self.maxfun:
      #         break
  
      #     parameters = self._scale_parameters(candidate)
      #     self.population_energies[index] = self.func(parameters,
      #                                                 *self.args)
      #     self._nfev += 1
  
      ##############
      ##############
  
      minval = np.argmin(self.population_energies)
  
      # put the lowest energy into the best solution position.
      lowest_energy = self.population_energies[minval]
      self.population_energies[minval] = self.population_energies[0]
      self.population_energies[0] = lowest_energy
  
      self.population[[0, minval], :] = self.population[[minval, 0], :]
code_tokens: def _calculate_population_energies ( self ) : itersize = max ( 0 , min ( len ( self . population ) , self . maxfun - self . _nfev + 1 ) ) candidates = self . population [ : itersize ] parameters = np . array ( [ self . _scale_parameters ( c ) for c in candidates ] ) energies = self . func ( parameters , * self . args ) self . population_energies = energies self . _nfev += itersize minval = np . argmin ( self . population_energies ) lowest_energy = self . population_energies [ minval ] self . population_energies [ minval ] = self . population_energies [ 0 ] self . population_energies [ 0 ] = lowest_energy self . population [ [ 0 , minval ] , : ] = self . population [ [ minval , 0 ] , : ]
short_docstring: Calculate the energies of all the population members at the same time.
short_docstring_tokens: Calculate the energies of all the population members at the same time .
comment: """
      Calculate the energies of all the population members at the same time.
      Puts the best member in first place. Useful if the population has just
      been initialised.
      """$SEP$##############$SEP$# CHANGES: self.func operates on the entire parameters array$SEP$##############$SEP$# TODO: can be vectorized$SEP$# for index, candidate in enumerate(self.population):$SEP$#     if self._nfev > self.maxfun:$SEP$#         break$SEP$#     parameters = self._scale_parameters(candidate)$SEP$#     self.population_energies[index] = self.func(parameters,$SEP$#                                                 *self.args)$SEP$#     self._nfev += 1$SEP$##############$SEP$##############$SEP$# put the lowest energy into the best solution position.