'find minimizer of `objectivefct` by iterating over `OOOptimizer` `self`
with verbosity `verb_disp`, using `BaseDataLogger` `logger` with at
most `iterations` iterations. ::
return self.result() + (self.stop(), self, logger)
Example
>>> import cma
>>> res = cma.CMAEvolutionStrategy(7 * [0.1], 0.5).optimize(cma.fcts.rosen, cma.CMADataLogger(), 100)
(4_w,9)-CMA-ES (mu_w=2.8,w_1=49%) in dimension 7 (seed=630721393)
Iterat #Fevals   function value     axis ratio  sigma   minstd maxstd min:sec
1       9 3.163954777181882e+01 1.0e+00 4.12e-01  4e-01  4e-01 0:0.0
2      18 3.299006223906629e+01 1.0e+00 3.60e-01  3e-01  4e-01 0:0.0
3      27 1.389129389866704e+01 1.1e+00 3.18e-01  3e-01  3e-01 0:0.0
100     900 2.494847340045985e+00 8.6e+00 5.03e-02  2e-02  5e-02 0:0.3
200    1800 3.428234862999135e-01 1.7e+01 3.77e-02  6e-03  3e-02 0:0.5
300    2700 3.216640032470860e-04 5.6e+01 6.62e-03  4e-04  9e-03 0:0.8
400    3600 6.155215286199821e-12 6.6e+01 7.44e-06  1e-07  4e-06 0:1.1
438    3942 1.187372505161762e-14 6.0e+01 3.27e-07  4e-09  9e-08 0:1.2
438    3942 1.187372505161762e-14 6.0e+01 3.27e-07  4e-09  9e-08 0:1.2
(\'termination by\', {\'tolfun\': 1e-11})
(\'best f-value =\', 1.1189867885201275e-14)
(\'solution =\', array([ 1.        ,  1.        ,  1.        ,  0.99999999,  0.99999998,
0.99999996,  0.99999992]))
>>> print(res[0])
[ 1.          1.          1.          0.99999999  0.99999998  0.99999996
0.99999992]'

def optimize(self, objectivefct, logger=None, verb_disp=20, iterations=None):

    if (logger is None):
        if hasattr(self, 'logger'):
            logger = self.logger
    citer = 0
    while (not self.stop()):
        if ((iterations is not None) and (citer >= iterations)):
            return self.result()
        citer += 1
        X = self.ask()
        fitvals = [objectivefct(x) for x in X]
        self.tell(X, fitvals)
        self.disp(verb_disp)
        (logger.add(self) if logger else None)
    (logger.add(self, modulo=bool(logger.modulo)) if logger else None)
    if verb_disp:
        self.disp(1)
    if (verb_disp in (1, True)):
        print('termination    by', self.stop())
        print('best    f-value    =', self.result()[1])
        print('solution    =', self.result()[0])
    return (self.result() + (self.stop(), self, logger))
