(self, number=None, xmean=None, sigma_fac=1)
return pop
get new candidate solutions in genotyp, sampled from a
        multi-variate normal distribution.

        Arguments are
            `number`
                number of returned solutions, by default the
                population size `popsize` (AKA lambda).
            `xmean`
                distribution mean
            `sigma_fac`
                multiplier for internal sample width (standard
                deviation)

        `ask_geno` returns a list of N-dimensional candidate solutions
        in genotyp representation and is called by `ask`.

        :See: `ask`, `ask_and_eval`
get new candidate solutions in genotyp, sampled from a
        multi-variate normal distribution.
get new candidate solutions in genotyp sampled from a multi - variate normal distribution .
def ask_geno(self, number=None, xmean=None, sigma_fac=1):
        """get new candidate solutions in genotyp, sampled from a
        multi-variate normal distribution.

        Arguments are
            `number`
                number of returned solutions, by default the
                population size `popsize` (AKA lambda).
            `xmean`
                distribution mean
            `sigma_fac`
                multiplier for internal sample width (standard
                deviation)

        `ask_geno` returns a list of N-dimensional candidate solutions
        in genotyp representation and is called by `ask`.

        :See: `ask`, `ask_and_eval`

        """

        if number is None or number < 1:
            number = self.sp.popsize
        if xmean is None:
            xmean = self.mean

        if self.countiter == 0:
            self.tic = time.clock()  # backward compatible
            self.elapsed_time = ElapsedTime()

        if self.opts['CMA_AII']:
            if self.countiter == 0:
                self.aii = AII(self.x0, self.sigma0)
            self.flgtelldone = False
            pop = self.aii.ask(number)
            return pop

        sigma = sigma_fac * self.sigma

        # update parameters for sampling the distribution
        #        fac  0      1      10
        # 150-D cigar:
        #           50749  50464   50787
        # 200-D elli:               == 6.9
        #                  99900   101160
        #                 100995   103275 == 2% loss
        # 100-D elli:               == 6.9
        #                 363052   369325  < 2% loss
        #                 365075   365755

        # update distribution
        if self.sp.CMA_on and (
                (self.opts['updatecovwait'] is None and
                 self.countiter >=
                     self.itereigenupdated + 1./(self.sp.c1+self.sp.cmu)/self.N/10
                 ) or
                (self.opts['updatecovwait'] is not None and
                 self.countiter > self.itereigenupdated + self.opts['updatecovwait']
                 )):
            self.updateBD()

        # sample distribution
        if self.flgtelldone:  # could be done in tell()!?
            self.flgtelldone = False
            self.ary = []

        # each row is a solution
        arz = self.randn((number, self.N))
        if 11 < 3:  # mutate along the principal axes only
            perm = np.random.permutation(self.N) # indices for mutated principal component
            for i in xrange(min((len(arz), self.N))):
                # perm = np.random.permutation(self.N)  # random principal component, should be much worse
                l = sum(arz[i]**2)**0.5
                arz[i] *= 0
                if 11 < 3: # mirrored sampling
                    arz[i][perm[int(i/2)]] = l * (2 * (i % 2) - 1)
                else:
                    arz[i][perm[i % self.N]] = l * np.sign(np.random.rand(1) - 0.5)
        if number == self.sp.popsize:
            self.arz = arz  # is never used
        else:
            pass

        if 11 < 3:  # normalize the length to chiN
            for i in xrange(len(arz)):
                # arz[i] *= exp(self.randn(1)[0] / 8)
                ss = sum(arz[i]**2)**0.5
                arz[i] *= self.const.chiN / ss
            # or to average
            # arz *= 1 * self.const.chiN / np.mean([sum(z**2)**0.5 for z in arz])

        # fac = np.mean(sum(arz**2, 1)**0.5)
        # print fac
        # arz *= self.const.chiN / fac
        self.ary = self.sigma_vec * np.dot(self.B, (self.D * arz).T).T
        pop = xmean + sigma * self.ary
        self.evaluations_per_f_value = 1

        return pop
def ask_geno ( self , number = None , xmean = None , sigma_fac = 1 ) : if number is None or number < 1 : number = self . sp . popsize if xmean is None : xmean = self . mean if self . countiter == 0 : self . tic = time . clock ( ) # backward compatible self . elapsed_time = ElapsedTime ( ) if self . opts [ 'CMA_AII' ] : if self . countiter == 0 : self . aii = AII ( self . x0 , self . sigma0 ) self . flgtelldone = False pop = self . aii . ask ( number ) return pop sigma = sigma_fac * self . sigma # update parameters for sampling the distribution #        fac  0      1      10 # 150-D cigar: #           50749  50464   50787 # 200-D elli:               == 6.9 #                  99900   101160 #                 100995   103275 == 2% loss # 100-D elli:               == 6.9 #                 363052   369325  < 2% loss #                 365075   365755 # update distribution if self . sp . CMA_on and ( ( self . opts [ 'updatecovwait' ] is None and self . countiter >= self . itereigenupdated + 1. / ( self . sp . c1 + self . sp . cmu ) / self . N / 10 ) or ( self . opts [ 'updatecovwait' ] is not None and self . countiter > self . itereigenupdated + self . opts [ 'updatecovwait' ] ) ) : self . updateBD ( ) # sample distribution if self . flgtelldone : # could be done in tell()!? self . flgtelldone = False self . ary = [ ] # each row is a solution arz = self . randn ( ( number , self . N ) ) if 11 < 3 : # mutate along the principal axes only perm = np . random . permutation ( self . N ) # indices for mutated principal component for i in xrange ( min ( ( len ( arz ) , self . N ) ) ) : # perm = np.random.permutation(self.N)  # random principal component, should be much worse l = sum ( arz [ i ] ** 2 ) ** 0.5 arz [ i ] *= 0 if 11 < 3 : # mirrored sampling arz [ i ] [ perm [ int ( i / 2 ) ] ] = l * ( 2 * ( i % 2 ) - 1 ) else : arz [ i ] [ perm [ i % self . N ] ] = l * np . sign ( np . random . rand ( 1 ) - 0.5 ) if number == self . sp . popsize : self . arz = arz # is never used else : pass if 11 < 3 : # normalize the length to chiN for i in xrange ( len ( arz ) ) : # arz[i] *= exp(self.randn(1)[0] / 8) ss = sum ( arz [ i ] ** 2 ) ** 0.5 arz [ i ] *= self . const . chiN / ss # or to average # arz *= 1 * self.const.chiN / np.mean([sum(z**2)**0.5 for z in arz]) # fac = np.mean(sum(arz**2, 1)**0.5) # print fac # arz *= self.const.chiN / fac self . ary = self . sigma_vec * np . dot ( self . B , ( self . D * arz ) . T ) . T pop = xmean + sigma * self . ary self . evaluations_per_f_value = 1 return pop