Home arrow Studies arrow Artificial Intelligence arrow Fuzzy Composition
Finding Family Groups by Fuzzy Composition PDF Print


A matrix contains numbers indicating cross relations of families. Is it possible to group the similar families? If yes, how can we use the relation information.

Solution lies on Fuzzy Composition.

 

 

Fuzzy Composition

P
:
Composition Relation

                       

                        if   then  (a P c) =  a () c.

 

                                  

           

To find Composition Relation, one technique is max-min composition. Here is the explanation of this technique:


 

C Source Code
 
This code is contains some bugs in finding number of families.

 
#include<stdio.h>
 
int A[16][16]={{10,  000050400008006},
              {01000808240500800},
              {0,  0,104020202222040},
              {0,  04,10020582284282},
              {0,  800,1004040000402},
              {5,  0220,100820004028},
              {0,  80040,10042800800},
              {4,  225080,1000004004},
              {0,  4084240,102440220},
              {0,  02200202,10280200},
              {0,  522008042,1000600},
              {0,  0280000480,100020},
              {8,  02404040000,10084},
              {0,  80240802260010,02},
              {0,  0480200200280,104},
              {6,  00228040000424,10}};
 
int Numbers[5] = {24 ,568};
 
int Maxx(int X[], int *imax)
{
   int i, min, max;
   max = 0;
   for(i=0;i<16;i++)
   {
               if ( X[i] > max)
                          max = X[i];
   }
   *imax = max;   

   return 0;
}
 
int Find_R_Infinite()
{
   int B[16][16], R[16][16], imax, X[16];
   int i, j, t, k, z, son, ayni, tmp;

   for(i=0;i<16;i++)
   {
      for(j=0;j<16;j++)
      {
                 B[i][j] = A[i][j];
      }
   }

   son = 0;
   while (son == 0 )
   {
      for(i=0;i<16;i++)
      {
         for(k=0;k<16;k++)
         {
            t= 0;
            for(j=0;j<16;j++)
            {
               if ( A[i][j] < B[j][k])
                  z = A[i][j];
               else
                  z = B[j][k];
               X[t] = z;
               t++;
            }
            Maxx(X, &imax);
            R[i][k] = imax;
         }

      }

      ayni = 0;
      for(i=0;i<16;i++)
      {
         for(j=0;j<16;j++)
         {
            if (R[i][j] == A[i][j])
               ayni++;
         }
      }
      if (ayni == 16*16// çik
                 son = 1;
      else
      {
         for(i=0;i<16;i++)
         {
            for(j=0;j<16;j++)
            {
               B[i][j] = A[i][j] = R[i][j];
            }
         }
      }
   }

   return 0;
}
 
int main(void)
{
   int i, j, k , m, n, Num[16][17], fam;
   FILE *f;

   Find_R_Infinite();
   
   f = fopen("r_infinite.txt""w");
   for(i=0;i<16;i++)
   {
               for(j=0;j<16;j++)
               {
                          fprintf(f, "%3d, ", A[i][j]);
               }
               fprintf(f, "\n");
   }
   fclose(f);
   f = fopen("Families.txt","w");
   for(k=0;k<5;k++)
   {
      fam = 0;
      n = Numbers[k];
      fprintf(f, "For alpha=%d\n", n);
      for(i=0;i<16;i++)
      {
         for(j=0;j<16;j++)
         {
            if (A[i][j] >= n)
            {
                Num[i][j] = 1;
            }          
            else
                Num[i][j] = 0;
            fprintf(f, "%2d, ", Num[i][j]);
         }
         fprintf(f, "\n");
      }

      fam = 0;
      for(i=0;i<16;i++)
      {
         j = 0;
         while ((j < i) && (Num[i][j] = 0))
            j++;
         if(j = i) 
         {
            fam++;
         }
      }
      fprintf(f, "Number of families: %d, ", fam);
      fprintf(f, "\n\n");
    }

   return 0;
}


Sample Execution
 

Sample Matrix

10,   0,   0,   0,   0,   5,   0,   4,   0,   0,   0,   0,   8,   0,   0,   6

0,  10,   0,   0,   8,   0,   8,   2,   4,   0,   5,   0,   0,   8,   0,   0

0,   0,  10,   4,   0,   2,   0,   2,   0,   2,   2,   2,   2,   0,   4,   0

0,   0,   4,  10,   0,   2,   0,   5,   8,   2,   2,   8,   4,   2,   8,   2

0,   8,   0,   0,  10,   0,   4,   0,   4,   0,   0,   0,   0,   4,   0,   2

5,   0,   2,   2,   0,  10,   0,   8,   2,   0,   0,   0,   4,   0,   2,   8

0,   8,   0,   0,   4,   0,  10,   0,   4,   2,   8,   0,   0,   8,   0,   0

4,   2,   2,   5,   0,   8,   0,  10,   0,   0,   0,   0,   4,   0,   0,   4

0,   4,   0,   8,   4,   2,   4,   0,  10,   2,   4,   4,   0,   2,   2,   0

0,   0,   2,   2,   0,   0,   2,   0,   2,  10,   2,   8,   0,   2,   0,   0

0,   5,   2,   2,   0,   0,   8,   0,   4,   2,  10,   0,   0,   6,   0,   0

0,   0,   2,   8,   0,   0,   0,   0,   4,   8,   0,  10,   0,   0,   2,   0

8,   0,   2,   4,   0,   4,   0,   4,   0,   0,   0,   0,  10,   0,   8,   4

0,   8,   0,   2,   4,   0,   8,   0,   2,   2,   6,   0,   0,  10,   0,   2

0,   0,   4,   8,   0,   2,   0,   0,   2,   0,   0,   2,   8,   0,  10,   4

6,   0,   0,   2,   2,   8,   0,   4,   0,   0,   0,   0,   4,   2,   4,  10

Found Matrix

10,   4,   4,   8,   4,   6,   4,   6,   8,   8,   4,   8,   8,   4,   8,   6

4,  10,   4,   4,   8,   4,   8,   4,   4,   4,   8,   4,   4,   8,   4,   4

4,   4,  10,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4

8,   4,   4,  10,   4,   6,   4,   6,   8,   8,   4,   8,   8,   4,   8,   6

4,   8,   4,   4,  10,   4,   8,   4,   4,   4,   8,   4,   4,   8,   4,   4

6,   4,   4,   6,   4,  10,   4,   8,   6,   6,   4,   6,   6,   4,   6,   8

4,   8,   4,   4,   8,   4,  10,   4,   4,   4,   8,   4,   4,   8,   4,   4

6,   4,   4,   6,   4,   8,   4,  10,   6,   6,   4,   6,   6,   4,   6,   8

8,   4,   4,   8,   4,   6,   4,   6,  10,   8,   4,   8,   8,   4,   8,   6

8,   4,   4,   8,   4,   6,   4,   6,   8,  10,   4,   8,   8,   4,   8,   6

4,   8,   4,   4,   8,   4,   8,   4,   4,   4,  10,   4,   4,   8,   4,   4

8,   4,   4,   8,   4,   6,   4,   6,   8,   8,   4,  10,   8,   4,   8,   6

8,   4,   4,   8,   4,   6,   4,   6,   8,   8,   4,   8,  10,   4,   8,   6

4,   8,   4,   4,   8,   4,   8,   4,   4,   4,   8,   4,   4,  10,   4,   4

8,   4,   4,   8,   4,   6,   4,   6,   8,   8,   4,   8,   8,   4,  10,   6

6,   4,   4,   6,   4,   8,   4,   8,   6,   6,   4,   6,   6,   4,   6,  10

 

Here are the family group matrices and numbers of families.

For alpha=2

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

Number of families: 1

For alpha=4

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1

Number of families: 1

For alpha=5

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

Number of families: 3

For alpha=6

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

1,  0,  0,  1,  0,  1,  0,  1,  1,  1,  0,  1,  1,  0,  1,  1

Number of families: 3

For alpha=8

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

0,  1,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  1,  0,  0

1,  0,  0,  1,  0,  0,  0,  0,  1,  1,  0,  1,  1,  0,  1,  0

0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1

Number of families: 4

 

Copyright 2003-2007 by Chasan Chouse.

Locations of visitors to this page