Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.ai.fuzzy    |    Fuzzy logic... all warm and fuzzy-like    |    1,275 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 671 of 1,275    |
|    Dmitry A. Kazakov to Evyn    |
|    Re: Fuzzy Union in C++    |
|    18 Jan 07 15:37:27    |
   
   From: mailbox@dmitry-kazakov.de   
      
   On 18 Jan 2007 05:41:53 -0800, Evyn wrote:   
      
   > Thanks Dmitry - I don't follow you exactly bu t I will investigate the   
   > use of maps.   
   >   
   > PS. the fuzzy sets can be very simple, for example:   
   >   
   > double fset1[4][2] = {{1,.2},{2,.3},{3,.4},{4,1.0}};   
   > double fset2[4][2] = {{1,.2},{3,.6},{4,1.0},{5,8}};   
      
   OK, the problem is that C does not have arrays, so you would need to wrap   
   your "pointers-to-pointers-to-double" thingy into a C++ class anyway. Just   
   to be able to return it as the result of a function. Doing so you will   
   loose nice array aggregates as above. Which aren't that nice, BTW.   
   Consider:   
      
    double RubbishSet [1][2] = {{1.0, 1000.0}};   
    // This is OK for the compiler, but meaningless   
      
   BTW, in case you think that such checks were unnecessary, you just did such   
   mistake already in the example you provided! See fset2, one missing "."   
   and...   
      
   You should do at least:   
      
   class TruthValue   
   {   
   public:   
    friend TruthValue operator & ... // And   
    friend TruthValue operator | ... // Or   
    friend TruthValue operator ~ ... // Not   
    TruthValue (double Value) ... // Constructor from double   
    operator double ... // Conversion to double   
    ...   
   private:   
    double Value; // The range 0.0..1.0 is enforced,   
    // You could consider a integer type as well,   
    // as a poor-man's implementation   
    // of a fixed-point numeric type.   
   };   
      
   class Pair   
   {   
    ...   
   private:   
    double Point;   
    TruthValue Level;   
   };   
      
   class FuzzySetOfSingletons   
   {   
   public:   
    friend FuzzySetOfSingletons operator & ... // Intersection   
    friend FuzzySetOfSingletons operator | ... // Union   
    ...   
   private:   
    ... // Some sorted container of Pairs   
   };   
      
   Whether you take a sorted container of Pairs or a map double -> TruthValue   
   is no matter. They are equivalent.   
      
   Last note. Weighted singletons is a quite poor class of fuzzy sets. It is   
   not closed on set-complement. So I would propose you to switch from   
   singletons to almost everywhere continuous functions. I am using functions   
   linear on a finite number of intervals.   
      
   --   
   Regards,   
   Dmitry A. Kazakov   
   http://www.dmitry-kazakov.de   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca