private static void PrintExample5() { Console.WriteLine("EXAMPLE 5"); IDomain u1 = IDomain.IntRange(1, 5); // {1,2,3,4} IDomain u2 = IDomain.IntRange(1, 4); // {1,2,3} IDomain u3 = IDomain.IntRange(1, 5); // {1,2,3,4} IFuzzySet r1 = new MutableFuzzySet(IDomain.Combine(u1, u2)) .Set(DomainElement.Of(1, 1), 0.3) .Set(DomainElement.Of(1, 2), 1) .Set(DomainElement.Of(3, 3), 0.5) .Set(DomainElement.Of(4, 3), 0.5); IFuzzySet r2 = new MutableFuzzySet(IDomain.Combine(u2, u3)) .Set(DomainElement.Of(1, 1), 1) .Set(DomainElement.Of(2, 1), 0.5) .Set(DomainElement.Of(2, 2), 0.7) .Set(DomainElement.Of(3, 3), 1) .Set(DomainElement.Of(3, 4), 0.4); IFuzzySet r1r2 = Relations.CompositionOfBinaryRelations(r1, r2) !; foreach (var element in r1r2.GetDomain()) { Console.WriteLine($"mu({element}) = {r1r2.GetValueAt(element)}"); } Console.WriteLine("---------------------------------------"); Console.WriteLine(); }
private static void PrintExample6() { Console.WriteLine("EXAMPLE 6"); IDomain uFinal = IDomain.IntRange(1, 5); // {1,2,3,4} IFuzzySet r = new MutableFuzzySet(IDomain.Combine(uFinal, uFinal)) .Set(DomainElement.Of(1, 1), 1) .Set(DomainElement.Of(2, 2), 1) .Set(DomainElement.Of(3, 3), 1) .Set(DomainElement.Of(4, 4), 1) .Set(DomainElement.Of(1, 2), 0.3) .Set(DomainElement.Of(2, 1), 0.3) .Set(DomainElement.Of(2, 3), 0.5) .Set(DomainElement.Of(3, 2), 0.5) .Set(DomainElement.Of(3, 4), 0.2) .Set(DomainElement.Of(4, 3), 0.2); IFuzzySet r2 = r; Console.WriteLine($"Pocetna relacija je neizrazita relacija ekvivalencija? {Relations.IsFuzzyEquivalence(r2)}"); Console.WriteLine(); for (var i = 0; i < 3; i++) { r2 = Relations.CompositionOfBinaryRelations(r2, r) !; Console.WriteLine($"Broj odradenih kompozicija je: {i + 1}. Relacija je: "); foreach (var element in r2.GetDomain()) { Console.WriteLine($"mu({element}) = {r2.GetValueAt(element)}"); } Console.WriteLine($"Ova relacija je neizrazita relacija ekvivalencije? {Relations.IsFuzzyEquivalence(r2)}"); Console.WriteLine(); } Console.WriteLine("---------------------------------------"); Console.WriteLine(); }