Go to the first, previous, next, last section, table of contents.


CNFVar -- Fuzzy variable

SYNOPSIS

#include <CNCL/FVar.h>

TYPE

CN_FVAR

BASE CLASSES

CNNamed

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:
CNFVar temp("Temperature", 0, 100);
enum { COLD, MEDIUM, WARM, HOT };
temp.add_value_set(COLD, new CNFSetTrapez("cold", 0, 10, 0, 10));
temp.add_value_set(MEDIUM, new CNFSetTrapez("medium", 20, 20, 10, 10));
temp.add_value_set(WARM, new CNFSetTrapez("warm", 30, 40, 10, 5));
temp.add_value_set(HOT, new CNFSetTrapez("hot", 40,100, 10, 0));
Here trapezium functions have been assumed as membership function, but all other kinds of (implemented) functions are possible.

Constructors:

CNFVar(CNParam *param);
CNFVar(double min = 0, double max = 1);
CNFVar(const CNString &xname, double min = 0, double max = 1);
Initializes the CNFVar.


In addition to the member functions required by CNCL, CNFVar 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.
CNFSet* fuzzy_value( CNFSet* x );
CNFSet* set_fuzzy_value( CNFSet* x );
Sets the fuzzy variable value (fuzzy set) to x and returns the old value.
CNFSet* fuzzy_value() const;
CNFSet* 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(CNFSet &fset);
void add_value_set(CNFSet *fset);
void add_value_set(int i, CNFSet &fset);
void add_value_set(int i, CNFSet *fset);
Adds the fuzzy set fset to the array of affiliated sets, either at position i (overwritting) or at the end (extending).
CNFSet *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 first, previous, next, last section, table of contents.