예제 #1
0
        public object Clone()
        {
            WeightsMatrix sm = new WeightsMatrix(Size);

            for (int i = 0; i < Size; i++)
            {
                for (int j = 0; j < Size; j++)
                {
                    sm.SetWeight(i, j, GetWeight(i, j));
                }
            }

            return(sm);
        }
예제 #2
0
        private WeightsMatrix BuildPartitionMatrix(IList <IDsmElement> nodes)
        {
            WeightsMatrix matrix = new WeightsMatrix(nodes.Count);

            for (int i = 0; i < nodes.Count; i++)
            {
                IDsmElement provider = nodes[i];

                for (int j = 0; j < nodes.Count; j++)
                {
                    if (j != i)
                    {
                        IDsmElement consumer = nodes[j];

                        int weight = _model.GetDependencyWeight(consumer.Id, provider.Id);

                        matrix.SetWeight(i, j, weight > 0 ? 1 : 0);
                    }
                }
            }

            return(matrix);
        }