Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public SortResult Sort()
        {
            SortResult vector = new SortResult(_element.Children.Count);

            if (_element.Children.Count > 1)
            {
                WeightsMatrix matrix = BuildPartitionMatrix(_element.Children);

                PartitioningCalculation algorithm = new PartitioningCalculation(matrix);

                vector = algorithm.Partition();
            }

            return(vector);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor of calcualtion on a given n * n matrix
 /// </summary>
 /// <param name="matrix"></param>
 public PartitioningCalculation(WeightsMatrix matrix)
 {
     _sm = matrix;
 }