class_docstr: Wrapper the Covariance Matrix Adaptation Evolutionary strategy (CMA-ES) optimization method. It works generating
  an stochastic search based on multivariate Gaussian samples. Only requires f and the box constraints to work.
class_docstr_tok: ["Wrapper","the","Covariance","Matrix","Adaptation","Evolutionary","strategy","(","CMA-ES",")","optimization","method",".","It","works","generating","an","stochastic","search","based","on","multivariate","Gaussian","samples",".","Only","requires","f","and","the","box","constraints","to","work","."]
docstr: :param x0: initial point for a local optimizer.
  :param f: function to optimize.
  :param df: gradient of the function to optimize.
  :param f_df: returns both the function to optimize and its gradient.
docstr_tok: [":","param","x0",":","initial","point","for","a","local","optimizer",".",":","param","f",":","function","to","optimize",".",":","param","df",":","gradient","of","the","function","to","optimize",".",":","param","f_df",":","returns","both","the","function","to","optimize","and","its","gradient","."]
code: def optimize(self, x0, f=None, df=None, f_df=None):
      """
      :param x0: initial point for a local optimizer.
      :param f: function to optimize.
      :param df: gradient of the function to optimize.
      :param f_df: returns both the function to optimize and its gradient.
      """
  
      if len(self.bounds) == 1:
          raise IndexError(
              "CMA does not work in problems of dimension 1."
          )
  
      try:
          import cma
  
          def CMA_f_wrapper(f):
              def g(x):
                  return f(np.array([x]))
  
              return g
  
          lB = np.asarray(self.bounds)[:, 0]
          uB = np.asarray(self.bounds)[:, 1]
          x = cma.fmin(
              CMA_f_wrapper(f),
              x0,
              0.6,
              options={"bounds": [lB, uB], "verbose": -1},
          )[0]
          return np.atleast_2d(x), f(np.atleast_2d(x))
      except ImportError:
          print(
              "Cannot find cma library, please install it to use this option."
          )
          raise
  
imports: import numpy
  from ..core.errors import InvalidVariableNameError
label_desc: Use image node_id 2 for calling the OptCma obj's underlying member method code with example usage: obj.optimize(x0, f, df, f_df) and returns: np,  f, g, f