Example #1
0
        private void Swap()
        {
            this.IsLeafNode = false;

            for (int i = 0; i < Params.q; i++)
            {
                // create node + set save path
                Node node = new Node(this, this.path + "node" + (children.Count + 1).ToString() + @"\", this.deltaX * Params.deltaMultiplyReduction, this.deltaY * Params.deltaMultiplyReduction, this.blx * Params.blxMultiplyIncrease, this.bly * Params.blyMultiplyIncrease);
                List<ClusterPair> clPairs = this.clusterPairs.Where(cp => cp.CurrentCenter == i).ToList();

                // set id of node
                node.Id = this.children.Count + 1;

                foreach (var item in clPairs)
                {
                    ClusterPair clusterPair = item.GetClone();
                    node.AddClusterPair(clusterPair);

                    // set reference to ClusterPair, which node correspond to this ClusterPair
                    item.CorrespondChild = node;

                    if (node == null)
                    {
                        throw new InvalidOperationException("Node cant be null");
                    }
                }

                // set parent to clusters X
                node.SetParentToXClusters();

                // count covariance patrix mean for probability counting
                // node.CountCovarianceMatrixMean();

                // set plastic/non plastic
                this.UpdatePlasticityOfParents(node);

                // add children
                this.children.Add(node);
            }
        }