class_docstr: A CMA-ES strategy that combines the :math:`(1 + \lambda)` paradigm
  [Igel2007]_, the mixed integer modification [Hansen2011]_, active
  covariance update [Arnold2010]_ and constraint handling [Arnold2012]_.
  This version of CMA-ES requires the random vector and the mutation
  that created each individual. The vector and mutation are stored in each
  individual as :attr:`_z` and :attr:`_y` respectively. Updating with
  individuals not containing these attributes will result in an
  :class:`AttributeError`.
  Notes:
      When using this strategy (especially when using constraints) you should
      monitor the strategy :attr:`condition_number`. If it goes above a given
      threshold (say :math:`10^{12}`), you should think of restarting the
      optimization as the covariance matrix is going degenerate. See the
      constrained active CMA-ES example for a simple example of restart.
  :param parent: An iterable object that indicates where to start the
                 evolution. The parent requires a fitness attribute.
  :param sigma: The initial standard deviation of the distribution.
  :param step: The minimal step size for each dimension. Use 0 for
               continuous dimensions.
  :param lambda_: Number of offspring to produce from the parent.
                  (optional, defaults to 1)
  :param **kwargs: One or more parameter to pass to the strategy as
                   described in the following table. (optional)
  +----------------+---------------------------+------------------------------+
  | Parameter      | Default                   | Details                      |
  +================+===========================+==============================+
  | ``d``          | ``1.0 + N / (2.0 *        | Damping for step-size.       |
  |                | lambda_)``                |                              |
  +----------------+---------------------------+------------------------------+
  | ``ptarg``      | ``1.0 / (5 + sqrt(lambda_)| Target success rate          |
  |                | / 2.0)``                  | (from 1 + lambda algorithm). |
  +----------------+---------------------------+------------------------------+
  | ``cp``         | ``ptarg * lambda_ / (2.0 +| Step size learning rate.     |
  |                | ptarg * lambda_)``        |                              |
  +----------------+---------------------------+------------------------------+
  | ``cc``         | ``2.0 / (N + 2.0)``       | Cumulation time horizon.     |
  +----------------+---------------------------+------------------------------+
  | ``ccov``       | ``2.0 / (N**2 + 6.0)``    | Covariance matrix learning   |
  |                |                           | rate.                        |
  +----------------+---------------------------+------------------------------+
  | ``ccovn``      | ``0.4 / (N**1.6 + 1.0)``  | Covariance matrix negative   |
  |                |                           | learning rate.               |
  +----------------+---------------------------+------------------------------+
  | ``cconst``     | ``1.0 / (N + 2.0)``       | Constraint vectors learning  |
  |                |                           | rate.                        |
  +----------------+---------------------------+------------------------------+
  | ``beta``       | ``0.1 / (lambda_ * (N +   | Covariance matrix learning   |
  |                |   2.0))``                 | rate for constraints.        |
  |                |                           |                              |
  +----------------+---------------------------+------------------------------+
  | ``pthresh``    | ``0.44``                  | Threshold success rate.      |
  +----------------+---------------------------+------------------------------+
  .. [Igel2007] Igel, Hansen and Roth. Covariance matrix adaptation for
     multi-objective optimization. 2007
  .. [Arnold2010] Arnold and Hansen. Active covariance matrix adaptation for
     the (1+1)-CMA-ES. 2010.
  .. [Hansen2011] Hansen. A CMA-ES for Mixed-Integer Nonlinear Optimization.
     Research Report] RR-7751, INRIA. 2011
  .. [Arnold2012] Arnold and Hansen. A (1+1)-CMA-ES for Constrained Optimisation.
     2012
class_docstr_tok: ["A","CMA-ES","strategy","that","combines","the",":","math",":","`","(","1","+","\\lambda",")","`","paradigm","[","Igel2007","]","_",",","the","mixed","integer","modification","[","Hansen2011","]","_",",","active","covariance","update","[","Arnold2010","]","_","and","constraint","handling","[","Arnold2012","]","_",".","This","version","of","CMA-ES","requires","the","random","vector","and","the","mutation","that","created","each","individual",".","The","vector","and","mutation","are","stored","in","each","individual","as",":","attr",":","`","_z","`","and",":","attr",":","`","_y","`","respectively",".","Updating","with","individuals","not","containing","these","attributes","will","result","in","an",":","class",":","`","AttributeError","`",".","Notes",":","When","using","this","strategy","(","especially","when","using","constraints",")","you","should","monitor","the","strategy",":","attr",":","`","condition_number","`",".","If","it","goes","above","a","given","threshold","(","say",":","math",":","`","10^","{","12","}","`",")",",","you","should","think","of","restarting","the","optimization","as","the","covariance","matrix","is","going","degenerate",".","See","the","constrained","active","CMA-ES","example","for","a","simple","example","of","restart",".",":","param","parent",":","An","iterable","object","that","indicates","where","to","start","the","evolution",".","The","parent","requires","a","fitness","attribute",".",":","param","sigma",":","The","initial","standard","deviation","of","the","distribution",".",":","param","step",":","The","minimal","step","size","for","each","dimension",".","Use","0","for","continuous","dimensions",".",":","param","lambda_",":","Number","of","offspring","to","produce","from","the","parent",".","(","optional",",","defaults","to","1",")",":","param","*","*","kwargs",":","One","or","more","parameter","to","pass","to","the","strategy","as","described","in","the","following","table",".","(","optional",")","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","Parameter","|","Default","|","Details","|","+================+===========================+==============================+","|","``","d","``","|","``","1.0","+","N","\/","(","2.0","*","|","Damping","for","step-size",".","|","|","|","lambda_",")","``","|","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","ptarg","``","|","``","1.0","\/","(","5","+","sqrt","(","lambda_",")","|","Target","success","rate","|","|","|","\/","2.0",")","``","|","(","from","1","+","lambda","algorithm",")",".","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","cp","``","|","``","ptarg","*","lambda_","\/","(","2.0","+|","Step","size","learning","rate",".","|","|","|","ptarg","*","lambda_",")","``","|","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","cc","``","|","``","2.0","\/","(","N","+","2.0",")","``","|","Cumulation","time","horizon",".","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","ccov","``","|","``","2.0","\/","(","N","*","*","2","+","6.0",")","``","|","Covariance","matrix","learning","|","|","|","|","rate",".","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","ccovn","``","|","``","0.4","\/","(","N","*","*","1.6","+","1.0",")","``","|","Covariance","matrix","negative","|","|","|","|","learning","rate",".","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","cconst","``","|","``","1.0","\/","(","N","+","2.0",")","``","|","Constraint","vectors","learning","|","|","|","|","rate",".","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","beta","``","|","``","0.1","\/","(","lambda_","*","(","N","+","|","Covariance","matrix","learning","|","|","|","2.0",")",")","``","|","rate","for","constraints",".","|","|","|","|","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","|","``","pthresh","``","|","``","0.44","``","|","Threshold","success","rate",".","|","+","--","--","--","--","--","--","--","--","+","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","+","..","[","Igel2007","]","Igel",",","Hansen","and","Roth",".","Covariance","matrix","adaptation","for","multi-objective","optimization",".","2007","..","[","Arnold2010","]","Arnold","and","Hansen",".","Active","covariance","matrix","adaptation","for","the","(","1+1",")","-CMA-ES",".","2010",".","..","[","Hansen2011","]","Hansen",".","A","CMA-ES","for","Mixed-Integer","Nonlinear","Optimization",".","Research","Report","]","RR-7751",",","INRIA",".","2011","..","[","Arnold2012","]","Arnold","and","Hansen",".","A","(","1+1",")","-CMA-ES","for","Constrained","Optimisation",".","2012"]
code: def _rank1update(self, individual, p_succ):
      update_cov = False
      self.psucc = (1 - self.cp) * self.psucc + self.cp * p_succ
  
      if (
          not hasattr(self.parent, "fitness")
          or self.parent.fitness <= individual.fitness
      ):
          self.parent = copy.deepcopy(individual)
          self.ancestors_fitness.append(
              copy.deepcopy(individual.fitness)
          )
          if len(self.ancestors_fitness) > 5:
              self.ancestors_fitness.pop()
  
          # Must guard if pc is all 0 to prevent w_norm_sqrd to be 0
          if self.psucc < self.pthresh or numpy.allclose(self.pc, 0):
              self.pc = (1 - self.cc) * self.pc + (
                  numpy.sqrt(self.cc * (2 - self.cc)) * individual._y
              )
  
              a = numpy.sqrt(1 - self.ccovp)
              w = numpy.dot(self.invA, self.pc)
              w_norm_sqrd = numpy.linalg.norm(w) ** 2
              b = (
                  numpy.sqrt(1 - self.ccovp)
                  / w_norm_sqrd
                  * (
                      numpy.sqrt(
                          1
                          + self.ccovp / (1 - self.ccovp) * w_norm_sqrd
                      )
                      - 1
                  )
              )
  
          else:
              self.pc = (1 - self.cc) * self.pc
  
              d = self.ccovp * (1 + self.cc * (2 - self.cc))
              a = numpy.sqrt(1 - d)
              w = numpy.dot(self.invA, self.pc)
              w_norm_sqrd = numpy.linalg.norm(w) ** 2
              b = (
                  numpy.sqrt(1 - d)
                  * (
                      numpy.sqrt(1 + self.ccovp * w_norm_sqrd / (1 - d))
                      - 1
                  )
                  / w_norm_sqrd
              )
  
          update_cov = True
  
      elif (
          len(self.ancestors_fitness) >= 5
          and individual.fitness < self.ancestors_fitness[0]
          and self.psucc < self.pthresh
      ):
          # Active covariance update requires w = z and not w = inv(A)s
          w = individual._z
          w_norm_sqrd = numpy.linalg.norm(w) ** 2
          if 1 < self.ccovn * (2 * w_norm_sqrd - 1):
              ccovn = 1 / (2 * w_norm_sqrd - 1)
          else:
              ccovn = self.ccovn
  
          a = numpy.sqrt(1 + ccovn)
          b = (
              numpy.sqrt(1 + ccovn)
              / w_norm_sqrd
              * (numpy.sqrt(1 - ccovn / (1 + ccovn) * w_norm_sqrd) - 1)
          )
          update_cov = True
  
      if update_cov:
          self.A = self.A * a + b * numpy.outer(numpy.dot(self.A, w), w)
          self.invA = 1 / a * self.invA - b / (
              a**2 + a * b * w_norm_sqrd
          ) * numpy.dot(self.invA, numpy.outer(w, w))
  
      # TODO: Add integer mutation i_I_R component
      self.sigma = self.sigma * numpy.exp(
          1.0
          / self.d
          * ((self.psucc - self.ptarg) / (1.0 - self.ptarg))
      )
  
imports: import copy
  from math import sqrt, log, exp
  from itertools import cycle
  import warnings
  import numpy
  from .None import tools
label_desc: Use image node_id 7 for calling the StrategyActiveOnePlusLambda obj's underlying member method code with example usage: obj._rank1update(individual, p_succ) without return types