original_docstring: 
      create a trial vector based on a mutation strategy
      
docstring: create a trial vector based on a mutation strategy
docstring_tokens: create a trial vector based on a mutation strategy
code: def _mutate(self, candidate):
      """
      create a trial vector based on a mutation strategy
      """
      trial = np.copy(self.population[candidate])
  
      rng = self.random_number_generator
  
      fill_point = rng.randint(0, self.parameter_count)
  
      if self.strategy in ['currenttobest1exp', 'currenttobest1bin']:
        bprime = self.mutation_func(candidate,
                                    self._select_samples(candidate, 5))
      else:
        bprime = self.mutation_func(self._select_samples(candidate, 5))
  
      if self.strategy in self._binomial:
        crossovers = rng.rand(self.parameter_count)
        crossovers = crossovers < self.cross_over_probability
        # the last one is always from the bprime vector for binomial
        # If you fill in modulo with a loop you have to set the last one to
        # true. If you don't use a loop then you can have any random entry
        # be True.
        crossovers[fill_point] = True
        trial = np.where(crossovers, bprime, trial)
        return trial
  
      elif self.strategy in self._exponential:
        i = 0
        while (i < self.parameter_count and
               rng.rand() < self.cross_over_probability):
  
          trial[fill_point] = bprime[fill_point]
          fill_point = (fill_point + 1) % self.parameter_count
          i += 1
  
        return trial
code_tokens: def _mutate ( self , candidate ) : trial = np . copy ( self . population [ candidate ] ) rng = self . random_number_generator fill_point = rng . randint ( 0 , self . parameter_count ) if self . strategy in [ 'currenttobest1exp' , 'currenttobest1bin' ] : bprime = self . mutation_func ( candidate , self . _select_samples ( candidate , 5 ) ) else : bprime = self . mutation_func ( self . _select_samples ( candidate , 5 ) ) if self . strategy in self . _binomial : crossovers = rng . rand ( self . parameter_count ) crossovers = crossovers < self . cross_over_probability crossovers [ fill_point ] = True trial = np . where ( crossovers , bprime , trial ) return trial elif self . strategy in self . _exponential : i = 0 while ( i < self . parameter_count and rng . rand ( ) < self . cross_over_probability ) : trial [ fill_point ] = bprime [ fill_point ] fill_point = ( fill_point + 1 ) % self . parameter_count i += 1 return trial
short_docstring: create a trial vector based on a mutation strategy
short_docstring_tokens: create a trial vector based on a mutation strategy
comment: """
      create a trial vector based on a mutation strategy
      """$SEP$# the last one is always from the bprime vector for binomial$SEP$# If you fill in modulo with a loop you have to set the last one to$SEP$# true. If you don't use a loop then you can have any random entry$SEP$# be True.