A fuzzy logic C++ library
Public Member Functions | Private Member Functions | Private Attributes
slifis::RULE Class Reference

Rule defined as linguistic terms, see Handling rules for usage. More...

#include <rule.hpp>

+ Inheritance diagram for slifis::RULE:
+ Collaboration diagram for slifis::RULE:

List of all members.

Public Member Functions

 RULE (EN_FIS_TYPE rt=TYPE_MAMDANI, EN_RULE_OP op=OPR_AND)
 RULE (EN_RULE_OP op, EN_FIS_TYPE rt=TYPE_MAMDANI, std::string outvalue="")
 RULE (EN_RULE_OP op, std::string outvalue, EN_FIS_TYPE rt=TYPE_MAMDANI)
void ClearConditions ()
void AddCondition (std::string input, std::string value)
 Add condition term to the rule.
void SetConsequence (std::string output_value)
 Set the consequence of the rule (Mamdani inference system type)
size_t GetNbTerms () const
std::string GetVarName (size_t idx) const
std::string GetVarValue (size_t idx) const
std::string GetVarValue (std::string input_name) const
std::string GetOutputValue () const
void Print (FILE *f, const char *msg=0) const

Private Member Functions

int P_FindVar (const std::string &input_name) const
 Searches terms for input input_name, returns its index if found or -1 if not.

Private Attributes

std::vector< RULE_TERM_v_terms
std::string _OutputValue
bool _HasOutputValue

Detailed Description

Rule defined as linguistic terms, see Handling rules for usage.

Inherits from ROOT_RULE, so can handle TS or Mamdani rules


Constructor & Destructor Documentation

slifis::RULE::RULE ( EN_RULE_OP  op,
EN_FIS_TYPE  rt = TYPE_MAMDANI,
std::string  outvalue = "" 
) [inline]
slifis::RULE::RULE ( EN_RULE_OP  op,
std::string  outvalue,
EN_FIS_TYPE  rt = TYPE_MAMDANI 
) [inline]

Member Function Documentation

References __IN__, and __OUT__.

Referenced by main().

void slifis::RULE::AddCondition ( std::string  input_name,
std::string  input_value 
)

Add condition term to the rule.

New (20120517):

  • new implementation as vector of std::pair .
  • now checks that input is not already used. If it is, then input_value will replace the previous value.

References __IN__, and __OUT__.

Referenced by main().

void slifis::RULE::SetConsequence ( std::string  output_value)

Set the consequence of the rule (Mamdani inference system type)

  • Argument is a linguistic term, that needs to match a corresponding string in the membership functions set of the output variable

References __IN__, and __OUT__.

Referenced by main().

size_t slifis::RULE::GetNbTerms ( ) const [inline]

References _v_terms.

Referenced by slifis::SLIFIS::AddRule().

std::string slifis::RULE::GetVarName ( size_t  idx) const
std::string slifis::RULE::GetVarValue ( size_t  idx) const
std::string slifis::RULE::GetVarValue ( std::string  input_name) const
std::string slifis::RULE::GetOutputValue ( ) const
void slifis::RULE::Print ( FILE *  f,
const char *  msg = 0 
) const
int slifis::RULE::P_FindVar ( const std::string &  input_name) const [private]

Searches terms for input input_name, returns its index if found or -1 if not.


Member Data Documentation

std::vector<RULE_TERM> slifis::RULE::_v_terms [private]

Referenced by GetNbTerms().

std::string slifis::RULE::_OutputValue [private]