fuzzylite  6.0 A Fuzzy Logic Control Library in C++
fl::Antecedent Class Reference

The Antecedent class is an expression tree that represents and evaluates the antecedent of a Rule. More...

#include <Antecedent.h>

Collaboration diagram for fl::Antecedent:

## Public Member Functions

Antecedent ()

virtual ~Antecedent ()

virtual void setText (const std::string &text)
Sets the antecedent in text. More...

virtual std::string getText () const
Gets the antecedent in text. More...

virtual ExpressiongetExpression () const
Gets the expression tree of the antecedent. More...

virtual void setExpression (Expression *expression)
Sets the expression tree of the antecedent. More...

virtual bool isLoaded () const
Indicates whether the antecedent is loaded. More...

virtual void unload ()
Unloads the antecedent. More...

virtual void load (const Engine *engine)
Loads the antecedent with the text obtained from Antecedent::getText() and uses the engine to identify and retrieve references to the input variables and output variables as required. More...

virtual void load (const std::string &antecedent, const Engine *engine)
Loads the antecedent with the given text and uses the engine to identify and retrieve references to the input variables and output variables as required. More...

virtual Complexity complexity (const TNorm *conjunction, const SNorm *disjunction) const
Computes the estimated complexity of calculating the activation degree. More...

virtual Complexity complexity (const TNorm *conjunction, const SNorm *disjunction, const Expression *node) const
Computes the estimated complexity of recursively calculating the activation degree from the given node. More...

virtual scalar activationDegree (const TNorm *conjunction, const SNorm *disjunction, const Expression *node) const
Computes the activation degree of the antecedent on the expression tree from the given node. More...

virtual scalar activationDegree (const TNorm *conjunction, const SNorm *disjunction) const
Computes the activation degree of the antecedent on the expression tree from the root node. More...

virtual std::string toString () const
Returns a string representation of the expression tree in infix notation. More...

virtual std::string toPrefix (const Expression *node=fl::null) const
Returns a string represention of the given expression tree utilizing prefix notation. More...

virtual std::string toInfix (const Expression *node=fl::null) const
Returns a string represention of the given expression tree utilizing infix notation. More...

virtual std::string toPostfix (const Expression *node=fl::null) const
Returns a string represention of the given expression tree utilizing postfix notation. More...

## Detailed Description

The Antecedent class is an expression tree that represents and evaluates the antecedent of a Rule.

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]*

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

Consequent
Rule
Since
4.0

Definition at line 48 of file Antecedent.h.

## ◆ Antecedent()

 fl::Antecedent::Antecedent ( )

## ◆ ~Antecedent()

 virtual fl::Antecedent::~Antecedent ( )
virtual

## ◆ activationDegree() [1/2]

 virtual scalar fl::Antecedent::activationDegree ( const TNorm * conjunction, const SNorm * disjunction, const Expression * node ) const
virtual

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

Parameters
 conjunction is the conjunction operator from the RuleBlock disjunction is the disjunction operator from the RuleBlock node is a node in the expression tree of the antecedent
Returns
the activation degree of the antecedent

## ◆ activationDegree() [2/2]

 virtual scalar fl::Antecedent::activationDegree ( const TNorm * conjunction, const SNorm * disjunction ) const
virtual

Computes the activation degree of the antecedent on the expression tree from the root node.

Parameters
 conjunction is the conjunction operator from the RuleBlock disjunction is the disjunction operator from the RuleBlock
Returns
the activation degree of the antecedent on the expression tree

## ◆ complexity() [1/2]

 virtual Complexity fl::Antecedent::complexity ( const TNorm * conjunction, const SNorm * disjunction ) const
virtual

Computes the estimated complexity of calculating the activation degree.

Returns
the estimated complexity of calculating the activation degree

## ◆ complexity() [2/2]

 virtual Complexity fl::Antecedent::complexity ( const TNorm * conjunction, const SNorm * disjunction, const Expression * node ) const
virtual

Computes the estimated complexity of recursively calculating the activation degree from the given node.

Returns
the estimated complexity of recursively calculating the activation degree from the given node

## ◆ getExpression()

 virtual Expression* fl::Antecedent::getExpression ( ) const
virtual

Gets the expression tree of the antecedent.

Returns
the expression tree of the antecedent

## ◆ getText()

 virtual std::string fl::Antecedent::getText ( ) const
virtual

Gets the antecedent in text.

Returns
the antecedent in text

 virtual bool fl::Antecedent::isLoaded ( ) const
virtual

Indicates whether the antecedent is loaded.

Returns
whether the antecedent is loaded

## ◆ load() [1/2]

 virtual void fl::Antecedent::load ( const Engine * engine )
virtual

Loads the antecedent with the text obtained from Antecedent::getText() and uses the engine to identify and retrieve references to the input variables and output variables as required.

Parameters
 engine is the engine from which the rules are part of

## ◆ load() [2/2]

 virtual void fl::Antecedent::load ( const std::string & antecedent, const Engine * engine )
virtual

Loads the antecedent with the given text and uses the engine to identify and retrieve references to the input variables and output variables as required.

Parameters
 antecedent is the antecedent of the rule in text engine is the engine from which the rules are part of

## ◆ setExpression()

 virtual void fl::Antecedent::setExpression ( Expression * expression )
virtual

Sets the expression tree of the antecedent.

Parameters
 expression is the expression tree of the antecedent

## ◆ setText()

 virtual void fl::Antecedent::setText ( const std::string & text )
virtual

Sets the antecedent in text.

Parameters
 text is the antecedent in text

## ◆ toInfix()

 virtual std::string fl::Antecedent::toInfix ( const Expression * node = fl::null ) const
virtual

Returns a string represention of the given expression tree utilizing infix notation.

Parameters
 node is a node in the expression tree of the antecedent
Returns
a string represention of the given expression tree utilizing infix notation

## ◆ toPostfix()

 virtual std::string fl::Antecedent::toPostfix ( const Expression * node = fl::null ) const
virtual

Returns a string represention of the given expression tree utilizing postfix notation.

Parameters
 node is a node in the expression tree of the antecedent
Returns
a string represention of the given expression tree utilizing postfix notation

## ◆ toPrefix()

 virtual std::string fl::Antecedent::toPrefix ( const Expression * node = fl::null ) const
virtual

Returns a string represention of the given expression tree utilizing prefix notation.

Parameters
 node is a node in the expression tree of the antecedent
Returns
a string represention of the given expression tree utilizing prefix notation

## ◆ toString()

 virtual std::string fl::Antecedent::toString ( ) const
virtual

Returns a string representation of the expression tree in infix notation.

Returns
a string representation of the expression tree in infix notation

 virtual void fl::Antecedent::unload ( )
virtual