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); } }
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); } } }