OutputVariable
OutputVariable
¶
Bases: Variable
Variable to represents the output of a fuzzy logic controller.
During the activation of a rule block, the activated terms of each rule are aggregated in the fuzzy output, which represents a fuzzy set hereinafter referred to as \(\tilde{y}\).
The defuzzification of \(\tilde{y}\) converts the fuzzy output value \(\tilde{y}\) into a crisp output value \(y\), which is stored as the value of this variable.
related
Attributes¶
fuzzy
instance-attribute
¶
fuzzy = Aggregated(name=name, minimum=minimum, maximum=maximum, aggregation=aggregation)
Functions¶
__init__
¶
__init__(
name: str = "",
description: str = "",
enabled: bool = True,
minimum: float = -inf,
maximum: float = inf,
lock_range: bool = False,
lock_previous: bool = False,
default_value: float = nan,
aggregation: SNorm | None = None,
defuzzifier: Defuzzifier | None = None,
terms: Iterable[Term] | None = None,
) -> None
Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
name of the variable |
''
|
description |
str
|
description of the variable |
''
|
enabled |
bool
|
enable the variable |
True
|
minimum |
float
|
minimum value of the variable |
-inf
|
maximum |
float
|
maximum value of the variable |
inf
|
lock_range |
bool
|
lock the value to the range of the variable |
False
|
lock_previous |
bool
|
lock the previous value of the output variable |
False
|
default_value |
float
|
default value of the output variable |
nan
|
aggregation |
SNorm | None
|
aggregation operator |
None
|
defuzzifier |
Defuzzifier | None
|
defuzzifier of the output variable |
None
|
terms |
Iterable[Term] | None
|
list of terms. |
None
|
__repr__
¶
__repr__() -> str
Return the code to construct the output variable in Python.
Returns:
Type | Description |
---|---|
str
|
code to construct the output variable in Python. |
__str__
¶
__str__() -> str
Return the code to construct the output variable in the FuzzyLite Language.
Returns:
Type | Description |
---|---|
str
|
code to construct the output variable in the FuzzyLite Language. |
defuzzify
¶
Defuzzify the output variable and store the output value and the previous output value.
The final value \(y\) depends on the following cascade of properties in order of precedence expressed in the FuzzyLite Language:
-
lock-previous: boolean
: when the output value is not finite (ie,nan
orinf
) andlock-previous: true
, then the output value is replaced with the value defuzzified in the previous iteration. -
default: scalar
: when the output value is (still) not finite and the default value is notnan
, then the output value is replaced with thedefault
value. -
lock-range: boolean
: whenlock-range: true
, the output value is clipped to the range of the variable.