Go to the previous, next section.

FlFVar -- Fuzzy variable

SYNOPSIS

#include <FuzzyLib/FVar.h>

TYPE

Fl_FVAR

BASE CLASSES

FlNamed

DERIVED CLASSES

None

RELATED CLASSES

None

DESCRIPTION

This class creates a fuzzy variable and its corrosponding linguistic variable. For example, the linguistic variable "temperature" migth be programmed this way:
FlFVar temp("Temperature", 0, 100);
enum { COLD, MEDIUM, WARM, HOT };
temp.add_value_set(COLD, new FlFSetTrapez("cold", 0, 10, 0, 10));
temp.add_value_set(MEDIUM, new FlFSetTrapez("medium", 20, 20, 10, 10));
temp.add_value_set(WARM, new FlFSetTrapez("warm", 30, 40, 10, 5));
temp.add_value_set(HOT, new FlFSetTrapez("hot", 40,100, 10, 0));
Here trapezium functions have been assumed as membership function, but all other kinds of (implemented) functions are possible.

Constructors:

FlFVar(FlParam *param);
FlFVar(double min = 0, double max = 1);
FlFVar(const FlString &xname, double min = 0, double max = 1);
Initializes the FlFVar.

In addition to the member functions required by FuzzyLib, FlFVar provides:

double value( double x );
double set_value( double x );
Sets the (non fuzzy) variable value to x and returns the old value.
double value() const
double get_value()const;
Returns the (non-fuzzy) value.

FlFSet* fuzzy_value( FlFSet* x );
FlFSet* set_fuzzy_value( FlFSet* x );
Sets the fuzzy variable value (fuzzy set) to x and returns the old value.
FlFSet* fuzzy_value() const;
FlFSet* get_fuzzy_value() const;
Returns the fuzzy value (fuzzy set).

double xmin() const;
double get_xmin() const;
double xmax() const;
double get_xmax() const;
Returns the minimum and maximum values of the variable's range.

void add_value_set(FlFSet &fset);
void add_value_set(FlFSet *fset);
void add_value_set(int i, FlFSet &fset);
void add_value_set(int i, FlFSet *fset);
Adds the fuzzy set fset to the array of affiliated sets, either at position i (overwritting) or at the end (extending).

FlFSet *get_value_set(int i);
Returns the fuzzy set at array position i.

double get_membership( int i);
Gets the membership value of the fuzzy set at array position i.

void print_membership();
Computes the membership value for all fuzzy sets using the current value and prints the result.

Go to the previous, next section.