(genome, **args)
This initializator accepts the follow parameters:

    *max_depth*
       The max depth of the tree

    *method*
       The method, accepts "grow", "full" or "ramped"

    .. versionadded:: 0.6
       The *GTreeGPInitializator* function.
This initializator accepts the follow parameters:
This initializator accepts the follow parameters :
def GTreeGPInitializator(genome, **args):
    """This initializator accepts the follow parameters:

    *max_depth*
       The max depth of the tree

    *method*
       The method, accepts "grow", "full" or "ramped"

    .. versionadded:: 0.6
       The *GTreeGPInitializator* function.
    """

    max_depth = genome.getParam("max_depth", 5)
    method = genome.getParam("method", "grow")
    ga_engine = args["ga_engine"]

    if method == "grow":
        root = GTree.buildGTreeGPGrow(ga_engine, 0, max_depth)
    elif method == "full":
        root = GTree.buildGTreeGPFull(ga_engine, 0, max_depth)
    elif method == "ramped":
        if Util.randomFlipCoin(0.5):
            root = GTree.buildGTreeGPFull(ga_engine, 0, max_depth)
        else:
            root = GTree.buildGTreeGPGrow(ga_engine, 0, max_depth)
    else:
        Util.raiseException("Unknown tree initialization method [%s] !" % method)

    genome.setRoot(root)
    genome.processNodes()
    assert genome.getHeight() <= max_depth
def GTreeGPInitializator ( genome , * * args ) : max_depth = genome . getParam ( "max_depth" , 5 ) method = genome . getParam ( "method" , "grow" ) ga_engine = args [ "ga_engine" ] if method == "grow" : root = GTree . buildGTreeGPGrow ( ga_engine , 0 , max_depth ) elif method == "full" : root = GTree . buildGTreeGPFull ( ga_engine , 0 , max_depth ) elif method == "ramped" : if Util . randomFlipCoin ( 0.5 ) : root = GTree . buildGTreeGPFull ( ga_engine , 0 , max_depth ) else : root = GTree . buildGTreeGPGrow ( ga_engine , 0 , max_depth ) else : Util . raiseException ( "Unknown tree initialization method [%s] !" % method ) genome . setRoot ( root ) genome . processNodes ( ) assert genome . getHeight ( ) <= max_depth