Esempio n. 1
0
        private static void SolveTaskForStream(StreamWriter stream, FuzzyRelation relation, string name)
        {
            stream.WriteLine(new string('~', 10) + name + new string('~', 10) + "\n" + relation);

            stream.WriteLine("GetStrongPreferenceRelation:\n" + relation.GetStrongPreferenceRelation());
            stream.WriteLine("GetSetOfNonDominatedAlternatives:\n" +
                              relation.GetSetOfNonDominatedAlternatives()
                                  .Aggregate("", (seed, val) => seed += val + "\t"));
            stream.WriteLine("Most non-dominated alternative: \n" + relation.GetMostNonDominatedAlternatives() + "\n");
        }
 public static FuzzyRelation MinMaxComposition(FuzzyRelation first, FuzzyRelation second)
 {
     var firstCount = first._relation.Length;
     var secondCount = second._relation[0].Length;
     var result = new double[firstCount][];
     for (var i = 0; i < firstCount; i++)
     {
         result[i] = new double[secondCount];
         for (var j = 0; j < secondCount; j++)
         {
             var firstRow = first._relation[i];
             var secondColumn = second._relation.Select(ar => ar[j]).ToArray();
             result[i][j] = Max(firstRow, secondColumn).Min();
         }
     }
     return new FuzzyRelation(result);
 }
 public bool IsIn(FuzzyRelation other)
 {
     for (var i = 0; i < _relation.Length; i++)
     {
         for (var j = 0; j < _relation[i].Length; j++)
         {
             if (_relation[i][j] > other._relation[i][j])
                 return false;
         }
     }
     return true;
 }