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

The Complexity class is used throughout the library to estimate the computational cost of the different components of the library. More...

#include <Complexity.h>

Collaboration diagram for fl::Complexity:

Public Types

typedef std::pair< std::string, scalarMeasure
 Returns a vector containing the measures of complexity. More...
 

Public Member Functions

 Complexity (scalar all=0.0)
 
 Complexity (scalar comparison, scalar arithmetic, scalar function)
 
virtual ~Complexity ()
 
Complexityoperator+= (const Complexity &other)
 
Complexityoperator-= (const Complexity &other)
 
Complexityoperator*= (const Complexity &other)
 
Complexityoperator/= (const Complexity &other)
 
Complexity operator+ (const Complexity &rhs) const
 
Complexity operator- (const Complexity &rhs) const
 
Complexity operator* (const Complexity &rhs) const
 
Complexity operator/ (const Complexity &rhs) const
 
bool operator== (const Complexity &rhs) const
 
bool operator!= (const Complexity &rhs) const
 
bool operator< (const Complexity &rhs) const
 
bool operator<= (const Complexity &rhs) const
 
bool operator> (const Complexity &rhs) const
 
bool operator>= (const Complexity &rhs) const
 
virtual Complexitycomparison (scalar comparison)
 Increases the comparison measure by the given amount. More...
 
virtual void setComparison (scalar comparison)
 
virtual scalar getComparison () const
 
virtual Complexityarithmetic (scalar arithmetic)
 Increases the arithmetic measure by the given amount. More...
 
virtual void setArithmetic (scalar arithmetic)
 
virtual scalar getArithmetic () const
 
virtual Complexityfunction (scalar function)
 Increases the function measure by the given amount. More...
 
virtual void setFunction (scalar function)
 
virtual scalar getFunction () const
 
virtual std::vector< Measuremeasures () const
 
virtual Complexityplus (const Complexity &x)
 Increases the complexity by the given parameter. More...
 
virtual Complexityminus (const Complexity &x)
 Reduces the complexity by the given parameter. More...
 
virtual Complexitymultiply (const Complexity &x)
 Multiplies the complexity by the given parameter. More...
 
virtual Complexitydivide (const Complexity &x)
 Divides the complexity by the given parameter. More...
 
virtual Complexityplus (scalar x)
 Increases each measure by the given parameter. More...
 
virtual Complexityminus (scalar x)
 Reduces each measure by the given parameter. More...
 
virtual Complexitymultiply (scalar x)
 Multiplies each measure by the given parameter. More...
 
virtual Complexitydivide (scalar x)
 Divides each measure by the given parameter. More...
 
virtual bool equals (const Complexity &x, scalar macheps=fuzzylite::macheps()) const
 Compares the complexity for equality to another with the given tolerance. More...
 
virtual bool lessThan (const Complexity &x, scalar macheps=fuzzylite::macheps()) const
 Compares the complexity for strict inequality (less than) to another with the given tolerance. More...
 
virtual bool lessThanOrEqualsTo (const Complexity &x, scalar macheps=fuzzylite::macheps()) const
 Compares the complexity for inequality (less than or equal to) to another with the given tolerance. More...
 
virtual bool greaterThan (const Complexity &x, scalar macheps=fuzzylite::macheps()) const
 Compares the complexity for strict inequality (greater than) to another with the given tolerance. More...
 
virtual bool greaterThanOrEqualsTo (const Complexity &x, scalar macheps=fuzzylite::macheps()) const
 Compares the complexity for inequality (greater than or equal to) to another with the given tolerance. More...
 
virtual scalar sum () const
 Computes the sum of the measures. More...
 
virtual scalar norm () const
 Computes the norm of the complexity. More...
 
virtual std::string toString () const
 Returns the measures of the complexity. More...
 
virtual Complexity compute (const Engine *engine) const
 Computes the complexity of the given engine as the sum of complexities of the rule blocks. More...
 
virtual Complexity compute (const InputVariable *inputVariable) const
 Computes the complexity of the given input variable. More...
 
virtual Complexity compute (const OutputVariable *outputVariable) const
 Computes the complexity of the given output variable. More...
 
virtual Complexity compute (const std::vector< InputVariable *> &inputVariables) const
 Computes the complexity of the given input variables. More...
 
virtual Complexity compute (const std::vector< OutputVariable *> &outputVariables, bool complexityOfDefuzzification=false) const
 Computes the complexity of the given output variables. More...
 
virtual Complexity compute (const std::vector< Variable *> &variables) const
 Computes the complexity of the given variables. More...
 
virtual Complexity compute (const RuleBlock *ruleBlock) const
 Computes the complexity of the given rule block. More...
 
virtual Complexity compute (const std::vector< RuleBlock *> &ruleBlocks) const
 Computes the complexity of the given rule blocks. More...
 

Detailed Description

The Complexity class is used throughout the library to estimate the computational cost of the different components of the library.

Author
Juan Rada-Vilela, Ph.D.
See also
Engine
Variable
OutputVariable
RuleBlock
Activation
Rule
Antecedent
Consequent
Hedge
Norm
Since
6.0

Definition at line 50 of file Complexity.h.

Member Typedef Documentation

◆ Measure

typedef std::pair<std::string, scalar> fl::Complexity::Measure

Returns a vector containing the measures of complexity.

Returns
a vector containing the measures of complexity

Definition at line 113 of file Complexity.h.

Constructor & Destructor Documentation

◆ Complexity() [1/2]

fl::Complexity::Complexity ( scalar  all = 0.0)
explicit

◆ Complexity() [2/2]

fl::Complexity::Complexity ( scalar  comparison,
scalar  arithmetic,
scalar  function 
)
explicit

◆ ~Complexity()

virtual fl::Complexity::~Complexity ( )
virtual

Member Function Documentation

◆ arithmetic()

virtual Complexity& fl::Complexity::arithmetic ( scalar  arithmetic)
virtual

Increases the arithmetic measure by the given amount.

Parameters
arithmeticis the amount to increase the comparison measure by
Returns
the reference to the Complexity object with the updated arithmetic measure

◆ comparison()

virtual Complexity& fl::Complexity::comparison ( scalar  comparison)
virtual

Increases the comparison measure by the given amount.

Parameters
comparisonis the amount to increase the comparison measure by
Returns
the reference to the Complexity object with the updated comparison measure

◆ compute() [1/8]

virtual Complexity fl::Complexity::compute ( const Engine engine) const
virtual

Computes the complexity of the given engine as the sum of complexities of the rule blocks.

Parameters
engineis the engine for which to compute the complexity
Returns
the complexity of the given engine as the sum of complexities of the rule blocks

◆ compute() [2/8]

virtual Complexity fl::Complexity::compute ( const InputVariable inputVariable) const
virtual

Computes the complexity of the given input variable.

Parameters
inputVariableis the input variable for which to compute the complexity
Returns
the complexity of the given input variable

◆ compute() [3/8]

virtual Complexity fl::Complexity::compute ( const OutputVariable outputVariable) const
virtual

Computes the complexity of the given output variable.

Parameters
outputVariableis the output variable for which to compute the complexity
Returns
the complexity of the given output variable

◆ compute() [4/8]

virtual Complexity fl::Complexity::compute ( const std::vector< InputVariable *> &  inputVariables) const
virtual

Computes the complexity of the given input variables.

Parameters
inputVariablesis the vector of input variables for which to compute the complexity
Returns
the complexity of the given input variables

◆ compute() [5/8]

virtual Complexity fl::Complexity::compute ( const std::vector< OutputVariable *> &  outputVariables,
bool  complexityOfDefuzzification = false 
) const
virtual

Computes the complexity of the given output variables.

Parameters
outputVariablesis the vector of output variables for which to compute the complexity
complexityOfDefuzzificationindicates whether to compute the complexity of the variable including the defuzzification process
Returns
the complexity of the given output variables

◆ compute() [6/8]

virtual Complexity fl::Complexity::compute ( const std::vector< Variable *> &  variables) const
virtual

Computes the complexity of the given variables.

Parameters
variablesis the vector of variables for which to compute the complexity
Returns
the complexity of the given variables

◆ compute() [7/8]

virtual Complexity fl::Complexity::compute ( const RuleBlock ruleBlock) const
virtual

Computes the complexity of the given rule block.

Parameters
ruleBlockis the rule block for which to compute the complexity
Returns
the complexity of the given rule block

◆ compute() [8/8]

virtual Complexity fl::Complexity::compute ( const std::vector< RuleBlock *> &  ruleBlocks) const
virtual

Computes the complexity of the given rule blocks.

Parameters
ruleBlocksis the vector of rule blocks for which to compute the complexity
Returns
Computes the complexity of the given rule blocks

◆ divide() [1/2]

virtual Complexity& fl::Complexity::divide ( const Complexity x)
virtual

Divides the complexity by the given parameter.

Parameters
xis the divisor
Returns
the reference to the updated complexity object

◆ divide() [2/2]

virtual Complexity& fl::Complexity::divide ( scalar  x)
virtual

Divides each measure by the given parameter.

Parameters
xis the divisor
Returns
the reference to the updated complexity

◆ equals()

virtual bool fl::Complexity::equals ( const Complexity x,
scalar  macheps = fuzzylite::macheps() 
) const
virtual

Compares the complexity for equality to another with the given tolerance.

Parameters
xis the complexity to compare against
machepsis the tolerance to compare floating-point values
Returns
true if every measure in this satisfies Op::isEq(this, x, macheps), and false otherwise

◆ function()

virtual Complexity& fl::Complexity::function ( scalar  function)
virtual

Increases the function measure by the given amount.

Parameters
functionis the amount to increase the function measure by
Returns
the reference to the Complexity object with the updated function measure

◆ getArithmetic()

virtual scalar fl::Complexity::getArithmetic ( ) const
virtual

◆ getComparison()

virtual scalar fl::Complexity::getComparison ( ) const
virtual

◆ getFunction()

virtual scalar fl::Complexity::getFunction ( ) const
virtual

◆ greaterThan()

virtual bool fl::Complexity::greaterThan ( const Complexity x,
scalar  macheps = fuzzylite::macheps() 
) const
virtual

Compares the complexity for strict inequality (greater than) to another with the given tolerance.

Parameters
xis the complexity to compare against
machepsis the tolerance to compare floating-point values
Returns
true if every measure in this satisfies Op::isGt(this, x, macheps), and false otherwise

◆ greaterThanOrEqualsTo()

virtual bool fl::Complexity::greaterThanOrEqualsTo ( const Complexity x,
scalar  macheps = fuzzylite::macheps() 
) const
virtual

Compares the complexity for inequality (greater than or equal to) to another with the given tolerance.

Parameters
xis the complexity to compare against
machepsis the tolerance to compare floating-point values
Returns
true if every measure in this satisfies Op::isGE(this, x, macheps), and false otherwise

◆ lessThan()

virtual bool fl::Complexity::lessThan ( const Complexity x,
scalar  macheps = fuzzylite::macheps() 
) const
virtual

Compares the complexity for strict inequality (less than) to another with the given tolerance.

Parameters
xis the complexity to compare against
machepsis the tolerance to compare floating-point values
Returns
true if every measure in this satisfies Op::isLt(this, x, macheps), and false otherwise

◆ lessThanOrEqualsTo()

virtual bool fl::Complexity::lessThanOrEqualsTo ( const Complexity x,
scalar  macheps = fuzzylite::macheps() 
) const
virtual

Compares the complexity for inequality (less than or equal to) to another with the given tolerance.

Parameters
xis the complexity to compare against
machepsis the tolerance to compare floating-point values
Returns
true if every measure in this satisfies Op::isLE(this, x, macheps), and false otherwise

◆ measures()

virtual std::vector<Measure> fl::Complexity::measures ( ) const
virtual

◆ minus() [1/2]

virtual Complexity& fl::Complexity::minus ( const Complexity x)
virtual

Reduces the complexity by the given parameter.

Parameters
xis the subtrahend
Returns
the reference to the updated complexity object

◆ minus() [2/2]

virtual Complexity& fl::Complexity::minus ( scalar  x)
virtual

Reduces each measure by the given parameter.

Parameters
xis the subtrahend
Returns
the reference to the updated complexity

◆ multiply() [1/2]

virtual Complexity& fl::Complexity::multiply ( const Complexity x)
virtual

Multiplies the complexity by the given parameter.

Parameters
xis the multiplicand
Returns
the reference to the updated complexity object

◆ multiply() [2/2]

virtual Complexity& fl::Complexity::multiply ( scalar  x)
virtual

Multiplies each measure by the given parameter.

Parameters
xis the multiplicand
Returns
the reference to the updated complexity

◆ norm()

virtual scalar fl::Complexity::norm ( ) const
virtual

Computes the norm of the complexity.

Returns
the norm of the complexity

◆ operator!=()

bool fl::Complexity::operator!= ( const Complexity rhs) const

◆ operator*()

Complexity fl::Complexity::operator* ( const Complexity rhs) const

◆ operator*=()

Complexity& fl::Complexity::operator*= ( const Complexity other)

◆ operator+()

Complexity fl::Complexity::operator+ ( const Complexity rhs) const

◆ operator+=()

Complexity& fl::Complexity::operator+= ( const Complexity other)

◆ operator-()

Complexity fl::Complexity::operator- ( const Complexity rhs) const

◆ operator-=()

Complexity& fl::Complexity::operator-= ( const Complexity other)

◆ operator/()

Complexity fl::Complexity::operator/ ( const Complexity rhs) const

◆ operator/=()

Complexity& fl::Complexity::operator/= ( const Complexity other)

◆ operator<()

bool fl::Complexity::operator< ( const Complexity rhs) const

◆ operator<=()

bool fl::Complexity::operator<= ( const Complexity rhs) const

◆ operator==()

bool fl::Complexity::operator== ( const Complexity rhs) const

◆ operator>()

bool fl::Complexity::operator> ( const Complexity rhs) const

◆ operator>=()

bool fl::Complexity::operator>= ( const Complexity rhs) const

◆ plus() [1/2]

virtual Complexity& fl::Complexity::plus ( const Complexity x)
virtual

Increases the complexity by the given parameter.

Parameters
xis the addend
Returns
the reference to the updated complexity

◆ plus() [2/2]

virtual Complexity& fl::Complexity::plus ( scalar  x)
virtual

Increases each measure by the given parameter.

Parameters
xis the addend
Returns
the reference to the updated complexity

◆ setArithmetic()

virtual void fl::Complexity::setArithmetic ( scalar  arithmetic)
virtual

◆ setComparison()

virtual void fl::Complexity::setComparison ( scalar  comparison)
virtual

◆ setFunction()

virtual void fl::Complexity::setFunction ( scalar  function)
virtual

◆ sum()

virtual scalar fl::Complexity::sum ( ) const
virtual

Computes the sum of the measures.

Returns
the sum of the measures

◆ toString()

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

Returns the measures of the complexity.

Returns
the measures of the complexity

The documentation for this class was generated from the following file: