Tree variable

Structure:

 tree.maxsize Scalar integer Max. number of nodes, nn
 tree.nodetyp Vector of integers (nn x 1) Type of nodes
 tree.node Vector of integers (nn x 1) Nodes
 tree.param Vector of reals (nn/2 x 1) Linear parameters
 tree.paramn Scalar integer Number of parameters


The maxsize is equal the maximum number of nodes (= 2^max. deepth-1) .

The nodetype contains the type of nodes. The value may be 1 or 2. If 1: operator, if 2: terminal node.
The vector contains the nodes of tree in a structured way from top to down, from left to right.

The node contains the index of the symbol assigned to the nodes.
The vector is structured in the same way as nodetype variable.
The indexes point to the gene.symbols variable. E.g. if nodetyp(i) = m and node(i) = n then the i-th node is gene.symlist{m}{n}.

The param contains the parameters of linear-in-parameters model represented by the tree.
The vector is structured as the GP-OLS toolbox extract the model-terms from the tree.

Examples:

%Generate random tree (with tree depth = 4)
tree = tree_genrnd(4,symbols);
%Draw the tree
tree_draw(tree,symbols);

%Tree by user
tree = tree_genuser(tree,symbols);
%Write the equation
disp(tree_stringrc(tree,1,symbols));