LinguisticVariable Class Reference

A composite of linguistic terms. More...

#include <LinguisticVariable.h>

Inheritance diagram for LinguisticVariable:

RCObject

List of all members.

Public Member Functions

 LinguisticVariable (const std::string name="", double lowerBound=-std::numeric_limits< double >::max(), double upperBound=std::numeric_limits< double >::max())
 The constructor sets the name and the range for the new linguistic variable, e.g.
virtual ~LinguisticVariable ()
 Destructor.
std::string getName () const
 Returns the name of the linguistic variable.
void setName (const std::string name)
 Sets the name of the linguistic variable.
void addTerm (LinguisticTerm *lt)
 Adds a new linguistic term.
void removeTerm (LinguisticTerm *lt)
 Removes the given LinguisticTerm from this variable.
int getNumberOfTerms ()
 Returns number of terms associated with the LinguisticVariable.
const RCPtr< LinguisticTermgetTerm (int whichOne)
 Returns a LinguisticTerm associated with this variable.
void setBounds (double lower, double upper)
 Sets a new range for the variable.
double getLowerBound ()
 Returns the lower bound of the variables range.
double getUpperBound ()
 Returns the upper bound of the variables range.
const RCPtr< LinguisticTermfindLT (std::string name)
 Returns an LinguisticTerm object specified by its name.

Static Public Member Functions

static LinguisticVariablegetLV (std::string name)
 Returns the linguistic variable for the given name if existent or throws FuzzyException otherwise.


Detailed Description

A composite of linguistic terms.

A linguistic variable combines linguistic terms like 'slow', 'moderately fast', 'fast', 'unbelievable fast' under a new name, e.g. 'speed'.

Definition at line 36 of file LinguisticVariable.h.


Constructor & Destructor Documentation

LinguisticVariable::LinguisticVariable ( const std::string  name = "",
double  lowerBound = -std::numeric_limits<double>::max(),
double  upperBound = std::numeric_limits<double>::max() 
)

The constructor sets the name and the range for the new linguistic variable, e.g.

( "Temperature", -10, 120 ).

The bounds also hold for the support of all derived fuzzy sets, i.e. regions outside these bounds are ignored for defuzzyfication.

Parameters:
name the variables name, e.g. "Temperature"
lowerBound lower bound of the variables range
upperBound upper bound of the variables range

Definition at line 45 of file LinguisticVariable.cpp.

LinguisticVariable::~LinguisticVariable (  )  [virtual]

Destructor.

Definition at line 37 of file LinguisticVariable.cpp.


Member Function Documentation

void LinguisticVariable::addTerm ( LinguisticTerm lt  ) 

Adds a new linguistic term.

This method shouldn't be necessary most of time, since a LinguisticTerm is associated with its LinguisticVariable durin construction.

Parameters:
lt the LinguisticTerm to add

Definition at line 64 of file LinguisticVariable.cpp.

const RCPtr< LinguisticTerm > LinguisticVariable::findLT ( std::string  name  ) 

Returns an LinguisticTerm object specified by its name.

Parameters:
name the name of the designated LinguisticTerm

Definition at line 92 of file LinguisticVariable.cpp.

Referenced by Rule::Rule().

double LinguisticVariable::getLowerBound (  )  [inline]

Returns the lower bound of the variables range.

Definition at line 105 of file LinguisticVariable.h.

LinguisticVariable * LinguisticVariable::getLV ( std::string  name  )  [static]

Returns the linguistic variable for the given name if existent or throws FuzzyException otherwise.

Definition at line 28 of file LinguisticVariable.cpp.

Referenced by Rule::Rule().

std::string LinguisticVariable::getName (  )  const

Returns the name of the linguistic variable.

Definition at line 51 of file LinguisticVariable.cpp.

int LinguisticVariable::getNumberOfTerms (  )  [inline]

Returns number of terms associated with the LinguisticVariable.

Definition at line 84 of file LinguisticVariable.h.

Referenced by getTerm().

const RCPtr< LinguisticTerm > LinguisticVariable::getTerm ( int  whichOne  ) 

Returns a LinguisticTerm associated with this variable.

Parameters:
whichOne index of the term ( 0 <= index < numerOfTerms )

Definition at line 79 of file LinguisticVariable.cpp.

References getNumberOfTerms().

double LinguisticVariable::getUpperBound (  )  [inline]

Returns the upper bound of the variables range.

Definition at line 110 of file LinguisticVariable.h.

void LinguisticVariable::removeTerm ( LinguisticTerm lt  ) 

Removes the given LinguisticTerm from this variable.

Parameters:
lt the LinguisticTerm to remove

Definition at line 69 of file LinguisticVariable.cpp.

void LinguisticVariable::setBounds ( double  lower,
double  upper 
)

Sets a new range for the variable.

The bounds also hold for the support of all derived fuzzy sets.

Parameters:
lower the lower bound
upper the upper bound

Definition at line 59 of file LinguisticVariable.cpp.

void LinguisticVariable::setName ( const std::string  name  ) 

Sets the name of the linguistic variable.

Parameters:
name the new name

Definition at line 55 of file LinguisticVariable.cpp.


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