'Test termination criteria and update dictionary.'

def _update(self, es):

    if (es.countiter == self.lastiter):
        if (es.countiter == 0):
            self.__init__()
            return self
        try:
            if (es == self.es):
                return self
        except:
            pass
    self.lastiter = es.countiter
    self.es = es
    self.stoplist = []
    N = es.N
    opts = es.opts
    self.opts = opts
    self._addstop('ftarget', (es.best.f < opts['ftarget']))
    self._addstop('maxfevals', ((es.countevals - 1) >= opts['maxfevals']))
    self._addstop('maxiter', (es.countiter >= opts['maxiter']))
    self._addstop('tolx', (all([((es.sigma * xi) < opts['tolx']) for xi in es.pc]) and all([((es.sigma * xi) < opts['tolx']) for xi in sqrt(es.dC)])))
    self._addstop('tolfacupx', any([((es.sigma * sig) > (es.sigma0 * opts['tolfacupx'])) for sig in sqrt(es.dC)]))
    self._addstop('tolfun', (((es.fit.fit[(-1)] - es.fit.fit[0]) < opts['tolfun']) and ((max(es.fit.hist) - min(es.fit.hist)) < opts['tolfun'])))
    self._addstop('tolfunhist', ((len(es.fit.hist) > 9) and ((max(es.fit.hist) - min(es.fit.hist)) < opts['tolfunhist'])))
    l = int(max(((opts['tolstagnation'] / 5.0) / 2), (len(es.fit.histbest) / 10)))
    if (11 < 3):
        print(es.countiter, (opts['tolstagnation'], (es.countiter > (N * (5 + (100 / es.popsize)))), (len(es.fit.histbest) > 100), (np.median(es.fit.histmedian[:l]) >= np.median(es.fit.histmedian[l:(2 * l)])), (np.median(es.fit.histbest[:l]) >= np.median(es.fit.histbest[l:(2 * l)]))))
    self._addstop('tolstagnation', ((1 < 3) and opts['tolstagnation'] and (es.countiter > (N * (5 + (100 / es.popsize)))) and (len(es.fit.histbest) > 100) and ((2 * l) < len(es.fit.histbest)) and (np.median(es.fit.histmedian[:l]) >= np.median(es.fit.histmedian[l:(2 * l)])) and (np.median(es.fit.histbest[:l]) >= np.median(es.fit.histbest[l:(2 * l)]))))
    self._addstop('tolupsigma', (opts['tolupsigma'] and (((es.sigma / es.sigma0) / np.max(es.D)) > opts['tolupsigma'])))
    if ((11 < 3) and ((2 * l) < len(es.fit.histbest))):
        tmp = np.array((((- np.median(es.fit.histmedian[:l])) + np.median(es.fit.histmedian[l:(2 * l)])), ((- np.median(es.fit.histbest[:l])) + np.median(es.fit.histbest[l:(2 * l)]))))
        es.more_to_write += [((10 ** t) if (t < 0) else (t + 1)) for t in tmp]
    if (1 < 3):
        self._addstop('noeffectcoord', any([(es.mean[i] == (es.mean[i] + ((0.2 * es.sigma) * sqrt(es.dC[i])))) for i in xrange(N)]))
        if ((opts['CMA_diagonal'] is not True) and (es.countiter > opts['CMA_diagonal'])):
            i = (es.countiter % N)
            self._addstop('noeffectaxis', (sum((es.mean == (es.mean + (((0.1 * es.sigma) * es.D[i]) * es.B[:, i])))) == N))
        self._addstop('conditioncov', (es.D[(-1)] > (10000000.0 * es.D[0])), 100000000000000.0)
        self._addstop('callback', es.callbackstop)
    if len(self):
        self._addstop('flat    fitness:    please    (re)consider    how    to    compute    the    fitness    more    elaborate', ((len(es.fit.hist) > 9) and (max(es.fit.hist) == min(es.fit.hist))))
    if ((11 < 3) and (opts['vv'] == 321)):
        self._addstop('||xmean||^2<ftarget', (sum((es.mean ** 2)) <= opts['ftarget']))
    return self
