#include <CNCL/FVar.h>
CN_FVAR
CNNamed
None
None
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);
CNFVar
.
In addition to the member functions required by CNCL, CNFVar
provides:
double value( double x );
double set_value( double x );
x
and returns the old value.
double value() const
double get_value()const;
CNFSet* fuzzy_value( CNFSet* x );
CNFSet* set_fuzzy_value( CNFSet* x );
x
and returns the
old value.
CNFSet* fuzzy_value() const;
CNFSet* get_fuzzy_value() const;
double xmin() const;
double get_xmin() const;
double xmax() const;
double get_xmax() const;
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);
fset
to the array of affiliated sets, either
at position i
(overwritting) or at the end (extending).
CNFSet *get_value_set(int i);
i
.
double get_membership( int i);
i
.
void print_membership();
Go to the first, previous, next, last section, table of contents.