1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 """
20 Base class for all fuzzy sets.
21 """
22
23 __revision__ = "$Id: Set.py,v 1.24 2010-10-29 19:24:41 rliebscher Exp $"
24
26 """Base class for all types of fuzzy sets."""
27
29 """Return membership of x in this fuzzy set.
30 This method makes the set work like a function.
31
32 @param x: value x
33 @type x: float
34 @return: membership for value x
35 @rtype: float
36 """
37 return 0.
38
40 """Internal helper function to help convert arbitrary fuzzy sets in
41 fuzzy sets represented by a polygon."""
42 return ((x,self(x)) for x in self.getValuesX())
43
45 """Internal helper function to help convert arbitrary fuzzy sets in
46 fuzzy sets represented by a polygon."""
47 raise NotImplementedError("Set has no values defined")
48
50 """Returns center of gravity.
51
52 @return: x-value of center of gravity
53 @rtype: float
54 """
55 raise NotImplementedError("abstract class %s has no center of gravity." % self.__class__.__name__)
56
58 """Return representation of instance.
59
60 @return: representation of instance
61 @rtype: string
62 """
63 return "%s.%s()" % (self.__class__.__module__, self.__class__.__name__)
64
65
66
67 from fuzzy.set.operations import norm,merge
68