Пример #1
0
        public CostMatrixByRef(ICostByIndex <TCost> weightmatrix, IList <TKey> orderedKeyItems)
        {
            this.weightmatrix = weightmatrix;

            mapper = new Dictionary <TKey, int>(new ByRefEqualityComparer());

            for (int i = 0; i < orderedKeyItems.Count; i++)
            {
                mapper.Add(orderedKeyItems[i], i);
            }
        }
Пример #2
0
        public CostMatrix(ICostByIndex <TCost> function, int dimension)
        {
            Matrix = new TCost[dimension][];

            for (int row = 0; row < dimension; row++)
            {
                Matrix[row] = new TCost[dimension];
                for (int col = 0; col < dimension; col++)
                {
                    Matrix[row][col] = function.Cost(row, col);
                }
            }
        }