public void TestUtil() { List <int> testData = new List <int>(); testData.Add(1); testData.Add(2); testData.Add(3); AggrerationUtil fu = new AggrerationUtil(); IEnumerable <IEnumerable <int> > result = fu.Permutation <int>(testData); Trace.WriteLine(result); }
public override decimal Calc(List<decimal> values) { List<int> indexes = new List<int>(); for (int i = 0; i < values.Count; i++) { indexes.Add(i); } AggrerationUtil au = new AggrerationUtil(); IEnumerable<IEnumerable<int>> permutationResult = au.Permutation<int>(indexes); decimal globalK = 0M; bool initGlobal = false; foreach (IEnumerable<int> e in permutationResult) { List<int> curentPermutation = e.ToList(); List<decimal> curentPermutationP = new List<decimal>(); foreach (int i in e) { curentPermutationP.Add(p[i]); } // First max Aggregation // Result is pSigma List<decimal> pSigma = new List<decimal>(); decimal lastMax = 0m; for (int i = 0; i < curentPermutationP.Count; i++) { decimal curentPValue = curentPermutationP[i]; if (i > 0) { decimal max = Math.Max(curentPValue, lastMax); curentPValue = max - lastMax; lastMax = max; } else { lastMax = curentPValue; } pSigma.Add(curentPValue); } List<decimal> permValues = new List<decimal>(); foreach (int i in e) { permValues.Add(values[i]); } //Calculate local K decimal localK = 0; for (int i = 0; i < pSigma.Count; i++) { localK += pSigma[i] * permValues[i]; } //Ckeck initial if (!initGlobal) { initGlobal = true; globalK = localK; } globalK = checkASPOWAAggregationType(this.type, globalK, localK); } IAggregation aggregation = AggregationFactory.CreateWeightAggregation(AggregationType.OWA, this.weights); decimal owaValue = aggregation.Calc(values); return this.beta * owaValue + (1 - this.beta) * globalK; }
public void TestUtil() { List<int> testData = new List<int>(); testData.Add(1); testData.Add(2); testData.Add(3); AggrerationUtil fu = new AggrerationUtil(); IEnumerable<IEnumerable<int>> result = fu.Permutation<int>(testData); Trace.WriteLine(result); }