Пример #1
0
        public TestNode(double weight, Test test)
            : base(weight)
        {
            if (test == null)
            {
                throw new ArgumentNullException("No Test defined.");
            }
            else
            {
                this._test = test;
            }

            this._sons = new Node[test.NumOfIssues];
            for (int i = 0; i < this._sons.Length; i++)
            {
                _sons[i]        = new OpenNode(0.0);
                _sons[i].Father = this;
            }

            this._hasOpenNode = true;
        }
        private IEnumerable <Node> ConvertToTestNode(IEnumerable <Node> nodes)
        {
            List <Node> retNodeList = new List <Node>();

            foreach (Node n in nodes)
            {
                if (n is LeafNode)
                {
                    LeafNode ln = new LeafNode(n.Weight);
                    ln.NbSons = n.NbSons;
                    ln.GoalValueDistribution = (n as LeafNode).GoalValueDistribution;
                    retNodeList.Add(ln);
                }
                else if (n is LearningOpenNode)
                {
                    OpenNode on = new OpenNode(n.Weight);
                    on.NbSons = n.NbSons;
                    retNodeList.Add(on);
                }
                else if (n is LearningTestNode)
                {
                    ScoreTestNode stn = new ScoreTestNode(
                        (n as LearningTestNode).Weight,
                        (n as LearningTestNode).Test,
                        (n as LearningTestNode).Score);

                    retNodeList.Add(stn);
                }
                else
                {
                    retNodeList.Add(n);
                }
            }

            return(retNodeList);
        }