public static INode GenerateNode(NodeContext context)
        {
            INode result = null;
            if (context.DepthLevel > 20)
            {
                result = new ConstantNode(context.GenerateNewLevel());
                return result;
            }

            int probability = 10;

            while (result == null)
            {
                if (RandomUtil.Random.Next(100) < probability)
                {
                    result = new AddNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability)
                {
                    result = new SubtractNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability)
                {
                    result = new MultiplyNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability)
                {
                    result = new DivideNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability)
                {
                    result = new InputSizeNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability)
                {
                    result = new CollectionSizeNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability && context.AvailableInputs.Count > 0)
                {
                    result = new InputVariableNode(context.GenerateNewLevel());
                }
                else if (RandomUtil.Random.Next(100) < probability && context.AvailableCollections.Count > 0)
                {
                    result = new SumNode(context.GenerateNewLevel());
                }
            }

            //NodeFactory.SimplifyNode(ref result);

            return result;
        }
 private INode MakeVarianceNode()
 {
     INode mean1 = this.MakeMeanNode();
     INode mean2 = this.MakeMeanNode();
     INode left1 = new InputVariableNode(0, new NodeContext());
     INode left2 = new InputVariableNode(0, new NodeContext());
     INode sub1 = new SubtractNode(new NodeContext(), left1, mean1);
     INode sub2 = new SubtractNode(new NodeContext(), left2, mean2);
     INode mult = new MultiplyNode(new NodeContext(), sub1, sub2);
     INode sum = new SumNode(new NodeContext(), 0, mult);
     INode divide = new DivideNode(new NodeContext(), sum, new CollectionSizeNode(0, new NodeContext()));
     return divide;
 }