1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 """Realize a Z-shaped fuzzy set."""
20
21 __revision__ = "$Id: ZFunction.py,v 1.17 2010-03-28 18:44:46 rliebscher Exp $"
22
23
24 from fuzzy.set.SFunction import SFunction
25
27 r"""Realize a Z-shaped fuzzy set::
28 __
29 \
30 |\
31 | \
32 | |\
33 | | \__
34 | a |
35 | |
36 2*delta
37
38 see also U{http://pyfuzzy.sourceforge.net/demo/set/ZFunction.png}
39
40 @ivar a: center of set.
41 @type a: float
42 @ivar delta: absolute distance between x-values for minimum and maximum.
43 @type delta: float
44 """
45
47 """Initialize a Z-shaped fuzzy set.
48
49 @param a: center of set
50 @type a: float
51 @param delta: absolute distance between x-values for minimum and maximum
52 @type delta: float
53 """
54 super(ZFunction, self).__init__(a, delta)
55
56
58 """Return membership of x in this fuzzy set.
59 This method makes the set work like a function.
60
61 @param x: value for which the membership is to calculate
62 @type x: float
63 @return: membership
64 @rtype: float
65 """
66 return 1.0 - SFunction.__call__(self, x)
67