Skip to content

InputVariable

InputVariable

Bases: Variable

Variable to represent the input of a fuzzy logic controller.

related

Functions

__init__

__init__(
    name: str = "",
    description: str = "",
    enabled: bool = True,
    minimum: float = -inf,
    maximum: float = inf,
    lock_range: bool = False,
    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
terms Iterable[Term] | None

list of terms.

None

__str__

__str__() -> str

Return the code to construct the input variable in the FuzzyLite Language.

Returns:

Type Description
str

code to construct the input variable in the FuzzyLite Language.

fuzzy_value

fuzzy_value() -> Array[str_]

Return the current fuzzy input value.

The fuzzy value is computed by evaluating the membership function of the current input value \(x\) for each term \(i\), resulting in a fuzzy input value in the form \(\tilde{x}=\sum_i{\mu_i(x)/i}\).

Returns:

Type Description
Array[str_]

current fuzzy value expressed as \(\sum_i{\mu_i(x)/i}\).