Skip to content

Commit d031e8f

Browse files
authored
fix: correct argument order in fuzzy set union (#15273)
FuzzySet is declared as (name, left_boundary, peak, right_boundary), but union passed (name, min_left, max_right, avg_peak), so peak and right_boundary were swapped. Swap the last two arguments and update both doctests. Fixes #11871 Signed-off-by: Ant19801108 <Ant19801108@users.noreply.github.com> Co-authored-by: Ant19801108 <Ant19801108@users.noreply.github.com>
1 parent 3d11d0c commit d031e8f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fuzzy_logic/fuzzy_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class FuzzySet:
5757
5858
# Union Operations
5959
>>> siya.union(sheru)
60-
FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=0.7, right_boundary=1.0)
60+
FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=1.0, right_boundary=0.7)
6161
"""
6262

6363
name: str
@@ -147,13 +147,13 @@ def union(self, other) -> FuzzySet:
147147
FuzzySet: A new fuzzy set representing the union.
148148
149149
>>> FuzzySet("a", 0.1, 0.2, 0.3).union(FuzzySet("b", 0.4, 0.5, 0.6))
150-
FuzzySet(name='a U b', left_boundary=0.1, peak=0.6, right_boundary=0.35)
150+
FuzzySet(name='a U b', left_boundary=0.1, peak=0.35, right_boundary=0.6)
151151
"""
152152
return FuzzySet(
153153
f"{self.name} U {other.name}",
154154
min(self.left_boundary, other.left_boundary),
155-
max(self.right_boundary, other.right_boundary),
156155
(self.peak + other.peak) / 2,
156+
max(self.right_boundary, other.right_boundary),
157157
)
158158

159159
def plot(self):

0 commit comments

Comments
 (0)