class_docstr: Differential evolution is typically used for continuous optimization.
  It uses differences between points in the population for doing mutations in fruitful directions;
  it is therefore a kind of covariance adaptation without any explicit covariance,
  making it super fast in high dimension. This class implements several variants of differential
  evolution, some of them adapted to genetic mutations as in
  `Holland’s work <https://en.wikipedia.org/wiki/Crossover_(genetic_algorithm)#Two-point_and_k-point_crossover>`_),
  (this combination is termed :code:`TwoPointsDE` in Nevergrad, corresponding to :code:`crossover="twopoints"`),
  or to the noisy setting (coined :code:`NoisyDE`, corresponding to :code:`recommendation="noisy"`).
  In that last case, the optimizer returns the mean of the individuals with fitness better than median,
  which might be stupid sometimes though.
  
  Default settings are CR =.5, F1=.8, F2=.8, curr-to-best, pop size is 30
  Initial population: pure random.
  
  Parameters
  ----------
  initialization: "parametrization", "LHS" or "QR" or "QO" or "SO"
      algorithm/distribution used for the initialization phase. If "parametrization", this uses the
      sample method of the parametrization.
  scale: float or str
      scale of random component of the updates
  recommendation: "pessimistic", "optimistic", "mean" or "noisy"
      choice of the criterion for the best point to recommend
  crossover: float or str
      crossover rate value, or strategy among:
      - "dimension": crossover rate of  1 / dimension,
      - "random": different random (uniform) crossover rate at each iteration
      - "onepoint": one point crossover
      - "twopoints": two points crossover
      - "rotated_twopoints": more genetic 2p cross-over
      - "parametrization": use the parametrization recombine method
  F1: float
      differential weight #1
  F2: float
      differential weight #2
  popsize: int, "standard", "dimension", "large"
      size of the population to use. "standard" is max(num_workers, 30), "dimension" max(num_workers, 30, dimension +1)
      and "large" max(num_workers, 30, 7 * dimension).
  multiobjective_adaptation: bool
      Automatically adapts to handle multiobjective case.  This is a very basic **experimental** version,
      activated by default because the non-multiobjective implementation is performing very badly.
  high_speed: bool
      Trying to make the optimization faster by a metamodel for the recommendation step.
class_docstr_tok: ["Differential","evolution","is","typically","used","for","continuous","optimization",".","It","uses","differences","between","points","in","the","population","for","doing","mutations","in","fruitful","directions",";","it","is","therefore","a","kind","of","covariance","adaptation","without","any","explicit","covariance",",","making","it","super","fast","in","high","dimension",".","This","class","implements","several","variants","of","differential","evolution",",","some","of","them","adapted","to","genetic","mutations","as","in","`","Holland","\u2019","s","work","<","https",":","\/\/en.wikipedia.org\/wiki\/Crossover_","(","genetic_algorithm",")","#","Two-point_and_k-point_crossover",">","`","_",")",",","(","this","combination","is","termed",":","code",":","`","TwoPointsDE","`","in","Nevergrad",",","corresponding","to",":","code",":","`","crossover=","''","twopoints","''","`",")",",","or","to","the","noisy","setting","(","coined",":","code",":","`","NoisyDE","`",",","corresponding","to",":","code",":","`","recommendation=","''","noisy","''","`",")",".","In","that","last","case",",","the","optimizer","returns","the","mean","of","the","individuals","with","fitness","better","than","median",",","which","might","be","stupid","sometimes","though",".","Default","settings","are","CR","=.5",",","F1=.8",",","F2=.8",",","curr-to-best",",","pop","size","is","30","Initial","population",":","pure","random",".","Parameters","--","--","--","--","--","initialization",":","``","parametrization","''",",","``","LHS","''","or","``","QR","''","or","``","QO","''","or","``","SO","''","algorithm\/distribution","used","for","the","initialization","phase",".","If","``","parametrization","''",",","this","uses","the","sample","method","of","the","parametrization",".","scale",":","float","or","str","scale","of","random","component","of","the","updates","recommendation",":","``","pessimistic","''",",","``","optimistic","''",",","``","mean","''","or","``","noisy","''","choice","of","the","criterion","for","the","best","point","to","recommend","crossover",":","float","or","str","crossover","rate","value",",","or","strategy","among",":","-","``","dimension","''",":","crossover","rate","of","1","\/","dimension",",","-","``","random","''",":","different","random","(","uniform",")","crossover","rate","at","each","iteration","-","``","onepoint","''",":","one","point","crossover","-","``","twopoints","''",":","two","points","crossover","-","``","rotated_twopoints","''",":","more","genetic","2p","cross-over","-","``","parametrization","''",":","use","the","parametrization","recombine","method","F1",":","float","differential","weight","#","1","F2",":","float","differential","weight","#","2","popsize",":","int",",","``","standard","''",",","``","dimension","''",",","``","large","''","size","of","the","population","to","use",".","``","standard","''","is","max","(","num_workers",",","30",")",",","``","dimension","''","max","(","num_workers",",","30",",","dimension","+1",")","and","``","large","''","max","(","num_workers",",","30",",","7","*","dimension",")",".","multiobjective_adaptation",":","bool","Automatically","adapts","to","handle","multiobjective","case",".","This","is","a","very","basic","*","*","experimental","*","*","version",",","activated","by","default","because","the","non-multiobjective","implementation","is","performing","very","badly",".","high_speed",":","bool","Trying","to","make","the","optimization","faster","by","a","metamodel","for","the","recommendation","step","."]
code: def __init__(
      self,
      *,
      initialization: str = "parametrization",
      scale: tp.Union[str, float] = 1.0,
      recommendation: str = "optimistic",
      crossover: tp.Union[str, float] = 0.5,
      F1: float = 0.8,
      F2: float = 0.8,
      popsize: tp.Union[str, int] = "standard",
      propagate_heritage: bool = False,  # experimental
      multiobjective_adaptation: bool = True,
      high_speed: bool = False,
  ) -> None:
      super().__init__(_DE, locals(), as_config=True)
      assert recommendation in [
          "optimistic",
          "pessimistic",
          "noisy",
          "mean",
      ]
      assert initialization in [
          "gaussian",
          "LHS",
          "QO",
          "SO",
          "QR",
          "parametrization",
      ]
  
      assert isinstance(scale, float) or scale == "mini"
      if not isinstance(popsize, int):
          assert popsize in ["large", "dimension", "standard", "small"]
      assert isinstance(crossover, float) or crossover in [
          "onepoint",
          "twopoints",
          "rotated_twopoints",
          "dimension",
          "random",
          "parametrization",
          "voronoi",
      ]
      self.initialization = initialization
      self.scale = scale
      self.high_speed = high_speed
      self.recommendation = recommendation
      self.propagate_heritage = propagate_heritage
      self.F1 = F1
      self.F2 = F2
      self.crossover = crossover
      self.popsize = popsize
      self.multiobjective_adaptation = multiobjective_adaptation
  
imports: import warnings
  import numpy
  import nevergrad.common.typing
  from nevergrad.parametrization import parameter
  from .None import metamodel
  from .None import base
  from .None import oneshot
label_desc: Use image node_id 1 to create a new DifferentialEvolution object from inherited base classes: base with example: obj = DifferentialEvolution()