Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        private static void PrintExample4()
        {
            Console.WriteLine("EXAMPLE 4");
            IDomain   u  = IDomain.IntRange(1, 6); // {1,2,3,4,5}
            IDomain   u2 = IDomain.Combine(u, u);
            IFuzzySet r1 = new MutableFuzzySet(u2)
                           .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(5, 5), 1)
                           .Set(DomainElement.Of(3, 1), 0.5)
                           .Set(DomainElement.Of(1, 3), 0.5);

            IFuzzySet r2 = new MutableFuzzySet(u2)
                           .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(5, 5), 1)
                           .Set(DomainElement.Of(3, 1), 0.5)
                           .Set(DomainElement.Of(1, 3), 0.1);

            IFuzzySet r3 = new MutableFuzzySet(u2)
                           .Set(DomainElement.Of(1, 1), 1)
                           .Set(DomainElement.Of(2, 2), 1)
                           .Set(DomainElement.Of(3, 3), 0.3)
                           .Set(DomainElement.Of(4, 4), 1)
                           .Set(DomainElement.Of(5, 5), 1)
                           .Set(DomainElement.Of(1, 2), 0.6)
                           .Set(DomainElement.Of(2, 1), 0.6)
                           .Set(DomainElement.Of(2, 3), 0.7)
                           .Set(DomainElement.Of(3, 2), 0.7)
                           .Set(DomainElement.Of(3, 1), 0.5)
                           .Set(DomainElement.Of(1, 3), 0.5);

            IFuzzySet r4 = new MutableFuzzySet(u2)
                           .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(5, 5), 1)
                           .Set(DomainElement.Of(1, 2), 0.4)
                           .Set(DomainElement.Of(2, 1), 0.4)
                           .Set(DomainElement.Of(2, 3), 0.5)
                           .Set(DomainElement.Of(3, 2), 0.5)
                           .Set(DomainElement.Of(1, 3), 0.4)
                           .Set(DomainElement.Of(3, 1), 0.4);

            var test1 = Relations.IsUTimesURelation(r1);

            Console.WriteLine($"r1 je definiran nad UxU? {test1}");

            var test2 = Relations.IsSymmetric(r1);

            Console.WriteLine($"r1 je simetrična? {test2}");

            var test3 = Relations.IsSymmetric(r2);

            Console.WriteLine($"r2 je simetrična? {test3}");

            var test4 = Relations.IsReflexive(r1);

            Console.WriteLine($"r1 je refleksivna? {test4}");

            var test5 = Relations.IsReflexive(r3);

            Console.WriteLine($"r3 je refleksivna? {test5}");

            var test6 = Relations.IsMaxMinTransitive(r3);

            Console.WriteLine($"r3 je max-min tranzitivna? {test6}");

            var test7 = Relations.IsMaxMinTransitive(r4);

            Console.WriteLine($"r4 je max-min tranzitivna? {test7}");
            Console.WriteLine("---------------------------------------");
            Console.WriteLine();
        }