Skip to content

Antecedent

Antecedent

Expression tree that represents and evaluates the antecedent of a rule.

structure

The structure of a rule is:
if (antecedent) then (consequent)

The structure of the antecedent of a rule is:
if variable is [hedge]* term [(and|or) variable is [hedge]* term]*


*-marked elements may appear zero or more times,
elements in brackets are optional, and
elements in parentheses are compulsory.

related

Attributes

expression instance-attribute

expression: Expression | None = None

text instance-attribute

text = text

Functions

__init__

__init__(text: str = '') -> None

Constructor.

Parameters:

Name Type Description Default
text str

antecedent as text.

''

__repr__

__repr__() -> str

Return the code to construct the antecedent in Python.

Returns:

Type Description
str

code to construct the antecedent in Python.

__str__

__str__() -> str

Return the antecedent as text.

Returns:

Type Description
str

antecedent as text

activation_degree

activation_degree(
    conjunction: TNorm | None = None, disjunction: SNorm | None = None, node: Expression | None = None
) -> Scalar

Compute the activation degree of the antecedent on the expression tree from the given node.

Parameters:

Name Type Description Default
conjunction TNorm | None

conjunction operator from the rule block

None
disjunction SNorm | None

disjunction operator from the rule block

None
node Expression | None

node in the expression tree of the antecedent

None

Returns:

Type Description
Scalar

activation degree of the antecedent.

infix

infix(node: Expression | None = None) -> str

Return the infix notation of the node.

Parameters:

Name Type Description Default
node Expression | None

node in the expression tree of the antecedent

None

Returns:

Type Description
str

infix notation of the node.

is_loaded

is_loaded() -> bool

Return whether the antecedent is loaded.

Returns:

Type Description
bool

antecedent is loaded.

load

load(engine: Engine) -> None

Load the antecedent using the engine to identify and get references to the input and output variables.

Parameters:

Name Type Description Default
engine Engine

engine to get references in the antecedent.

required

postfix

postfix(node: Expression | None = None) -> str

Return the postfix notation of the node.

Parameters:

Name Type Description Default
node Expression | None

node in the expression tree of the antecedent

None

Returns:

Type Description
str

postfix notation of the node.

prefix

prefix(node: Expression | None = None) -> str

Return the prefix notation of the node.

Parameters:

Name Type Description Default
node Expression | None

node in the expression tree of the antecedent

None

Returns:

Type Description
str

prefix notation of the node.

unload

unload() -> None

Unload the antecedent.