(genome, **args)
Allele initialization function of G2DList

    To use this initializator, you must specify the *allele* genome parameter with the
    :class:`GAllele.GAlleles` instance.

    .. warning:: the :class:`GAllele.GAlleles` instance must have the homogeneous flag enabled
Allele initialization function of G2DList
Allele initialization function of G2DList
def G2DListInitializatorAllele(genome, **args):
    """ Allele initialization function of G2DList

    To use this initializator, you must specify the *allele* genome parameter with the
    :class:`GAllele.GAlleles` instance.

    .. warning:: the :class:`GAllele.GAlleles` instance must have the homogeneous flag enabled

    """

    allele = genome.getParam("allele", None)
    if allele is None:
        Util.raiseException("to use the G2DListInitializatorAllele, you must specify the 'allele' parameter")

    if not allele.homogeneous:
        Util.raiseException("to use the G2DListInitializatorAllele, the 'allele' must be homogeneous")

    genome.clearList()

    for i in xrange(genome.getHeight()):
        for j in xrange(genome.getWidth()):
            random_allele = allele[0].getRandomAllele()
            genome.setItem(i, j, random_allele)
def G2DListInitializatorAllele ( genome , * * args ) : allele = genome . getParam ( "allele" , None ) if allele is None : Util . raiseException ( "to use the G2DListInitializatorAllele, you must specify the 'allele' parameter" ) if not allele . homogeneous : Util . raiseException ( "to use the G2DListInitializatorAllele, the 'allele' must be homogeneous" ) genome . clearList ( ) for i in xrange ( genome . getHeight ( ) ) : for j in xrange ( genome . getWidth ( ) ) : random_allele = allele [ 0 ] . getRandomAllele ( ) genome . setItem ( i , j , random_allele )