(ga_engine, depth, max_depth)
return n
Creates a new random GTreeGP root node with subtrees using
    the "Full" method.

    :param ga_engine: the GA Core
    :param depth: the initial depth
    :max_depth: the maximum depth of the tree
    :rtype: the root node
Creates a new random GTreeGP root node with subtrees using
    the "Full" method.
Creates a new random GTreeGP root node with subtrees using the Full method .
def buildGTreeGPFull(ga_engine, depth, max_depth):
    """ Creates a new random GTreeGP root node with subtrees using
    the "Full" method.

    :param ga_engine: the GA Core
    :param depth: the initial depth
    :max_depth: the maximum depth of the tree
    :rtype: the root node
    """
    gp_terminals = ga_engine.getParam("gp_terminals")
    assert gp_terminals is not None

    gp_function_set = ga_engine.getParam("gp_function_set")
    assert gp_function_set is not None

    if depth == max_depth:
        random_terminal = checkTerminal(random.choice(gp_terminals))
        n = GTreeNodeGP(random_terminal, Consts.nodeType["TERMINAL"])
        return n
    else:
        random_oper = random.choice(gp_function_set.keys())
        n = GTreeNodeGP(random_oper, Consts.nodeType["NONTERMINAL"])

    if n.getType() == Consts.nodeType["NONTERMINAL"]:
        for i in xrange(gp_function_set[n.getData()]):
            child = buildGTreeGPFull(ga_engine, depth + 1, max_depth)
            child.setParent(n)
            n.addChild(child)

    return n
def buildGTreeGPFull ( ga_engine , depth , max_depth ) : gp_terminals = ga_engine . getParam ( "gp_terminals" ) assert gp_terminals is not None gp_function_set = ga_engine . getParam ( "gp_function_set" ) assert gp_function_set is not None if depth == max_depth : random_terminal = checkTerminal ( random . choice ( gp_terminals ) ) n = GTreeNodeGP ( random_terminal , Consts . nodeType [ "TERMINAL" ] ) return n else : random_oper = random . choice ( gp_function_set . keys ( ) ) n = GTreeNodeGP ( random_oper , Consts . nodeType [ "NONTERMINAL" ] ) if n . getType ( ) == Consts . nodeType [ "NONTERMINAL" ] : for i in xrange ( gp_function_set [ n . getData ( ) ] ) : child = buildGTreeGPFull ( ga_engine , depth + 1 , max_depth ) child . setParent ( n ) n . addChild ( child ) return n