class_docstr: Class defining mutations, and holding a random state used for random generation.
class_docstr_tok: ["Class","defining","mutations",",","and","holding","a","random","state","used","for","random","generation","."]
docstr: This is the anisotropic counterpart of the classical 1+1 mutations in discrete domains
  with tunable intensity: it is useful for anisotropic adaptivity.
docstr_tok: ["This","is","the","anisotropic","counterpart","of","the","classical","1+1","mutations","in","discrete","domains","with","tunable","intensity",":","it","is","useful","for","anisotropic","adaptivity","."]
code: def coordinatewise_mutation(
      self,
      parent: tp.ArrayLike,
      velocity: tp.ArrayLike,
      boolean_vector: tp.ArrayLike,
      arity: int,
  ) -> tp.ArrayLike:
      """This is the anisotropic counterpart of the classical 1+1 mutations in discrete domains
      with tunable intensity: it is useful for anisotropic adaptivity.
      """
      dimension = len(parent)
      boolean_vector = np.zeros(dimension, dtype=bool)
      while not any(boolean_vector):
          boolean_vector = self.random_state.rand(dimension) < (
              1.0 / dimension
          )
      discrete_data = discretization.threshold_discretization(
          parent, arity=arity
      )
      discrete_data = np.where(  # type: ignore
          boolean_vector,
          discrete_data
          + self.random_state.choice([-1.0, 1.0], size=dimension)
          * velocity,
          discrete_data,
      )
      return discretization.inverse_threshold_discretization(
          discrete_data
      )
  
file_path: nevergrad/nevergrad/optimization/mutations.py
imports: import numpy
  import nevergrad.common.typing
  from nevergrad.parametrization import discretization
  from .None import utils
label_desc: Use image node_id 7 for calling the Mutator obj's underlying member method code with example usage: obj.coordinatewise_mutation(parent, velocity, boolean_vector, arity) and returns: discretization