File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 44
55import matplotlib .pyplot as plt
66import numpy as np
7-
87@dataclass
98class FuzzySet :
109 """
@@ -16,7 +15,7 @@ class FuzzySet:
1615 right_boundary : float
1716
1817 def __str__ (self ) -> str :
19- return f"{ self .name } : [{ self .left_boundary } , { self .peak } , { self .right_boundary } ]"
18+ return f"{ self .name } :[{ self .left_boundary } , { self .peak } , { self .right_boundary } ]"
2019
2120 def complement (self ) -> FuzzySet :
2221 return FuzzySet (
@@ -40,8 +39,7 @@ def membership(self, x: float) -> float:
4039 elif self .left_boundary < x <= self .peak :
4140 return (x - self .left_boundary ) / (self .peak - self .left_boundary )
4241 elif self .peak < x < self .right_boundary :
43- return (self .right_boundary - x ) / (self .right_boundary - self .peak )
44-
42+ return (self .right_boundary - x ) / (self .right_boundary - self .peak )
4543 msg = f"Invalid value { x } for fuzzy set { self } "
4644 raise ValueError (msg )
4745
You can’t perform that action at this time.
0 commit comments