A fuzzy logic C++ library
|
This namespace includes all root classes, functions, and datatypes of the library. More...
Classes | |
class | DATA_DESCR |
Data description: what do we want in the datafile ? What column of data ? More... | |
class | VALUE |
Abstract data type used in class DATA_POINT, see inherited classes VALUE_NUM and VALUE_STRING. More... | |
class | VALUE_NUM |
Numerical value, used in class DATA_POINT. More... | |
class | VALUE_STRING |
String value, used in class DATA_POINT. More... | |
class | VALUE_STRING_INDEX |
String value stored as an index in DATA_SET, used in class DATA_POINT. More... | |
class | DATA_POINT |
Abstract data point, can hold several numerical and string attributes. More... | |
class | DATA_SET |
This class is intended to hold all the loaded data points for further processing. More... | |
class | DATAFILE_INFO |
Holds information on a given data file: what columns are numeric, what columns are strings, etc. More... | |
class | DATASET_PROPERTIES |
class | ERROR_HANDLER |
This class is used to hold information about an error that occurred. It inherits from std::exception. More... | |
class | FPOINT |
A point of a membership function = a pair (REALVAL,FUZZYVAL) More... | |
class | FUZZY_IN |
Set of input membership functions. More... | |
class | FUZZY_OUT |
A set of output membership functions. More... | |
class | FUZZY_ROOT |
Virtual class, designed to be inherited into FUZZY_IN and FUZZY_OUT. More... | |
class | FUZZYVAL |
A class for a fuzzy value [0-1]. More... | |
class | GNUPLOT_FILE |
A gnuplot script file for plotting histograms, opens it, and adds a common header. More... | |
class | INPUT_RANGE |
A range of numerical values, used to iterate from minimum to maximum value using a number of steps. More... | |
class | INPUT_SETS |
Holds all the sets of input membership functions. More... | |
class | MEMBFUNC |
A membership function, defined as a vector of points. More... | |
class | RB_TABLE |
A rule base of 2 inputs, represented as a table (computed only when needed). Private class, do not use in your code! More... | |
class | ROOT_RULE |
Root virtual class for rule, inherited into RULE and RULE_IDX. More... | |
class | RULE |
Rule defined as linguistic terms, see Handling rules for usage. More... | |
struct | RBB_PARAMS |
Holds parameters for rule base building from data, see Learning rules from data. More... | |
class | RULE_BASE |
Rule base, expressed as a vector of RULE_IDX. More... | |
struct | ESTIM_ERROR |
A structure holding numerical values on errors when estimating TS coefficients from a subset. More... | |
class | RULE_IDX |
Rule defined as array of indexes on input and output sets of membership functions. More... | |
struct | INF_PARAMS |
Parameters of inference process. More... | |
class | SLIFIS |
This is the main class of the library, holds everything is required for a Fis. More... | |
Typedefs | |
typedef double | NUM_TYPE |
size of numerical values for DATA_POINT_NUM, switch to float and rebuild if memory issues. | |
typedef boost::shared_ptr< VALUE > | VALUE_PTR |
typedef std::pair< std::string, size_t > | PAIR_STRING_COUNT |
A type using for storing the string-attribute value and its associated counter, see class DATA_SET. | |
typedef std::pair< std::string, EN_DATA_FIELD_TYPE > | PAIR_ATTRIB_NT |
A type using for storing the attributes names and types. | |
typedef uchar | RULE_NBFUNC_SIZE |
Datatype for the indexes of membership functions, possibles values are uchar, uint, ... | |
typedef uchar | RULE_NBVAR_SIZE |
Datatype for the indexes of input/output variables, possibles values are uchar, uint, ... | |
typedef std::map < RULE_NBVAR_SIZE, RULE_NBFUNC_SIZE > | RULE_IDX_TERM |
This is an alias for an STL map container, that holds pairs of indexes, one on the input variable, one on the membership function. | |
typedef double | REALVAL |
Any real value. | |
typedef unsigned char | uchar |
Enumerations | |
enum | EN_READ_LINE_STATUS { ST_FAILURE = 0, ST_DATALINE, ST_COMMENT } |
Used in data file I/O operations. More... | |
enum | EN_MinMaxValue { MM_Min, MM_Max } |
Used for retrieving Min/Max value of a dataset. More... | |
enum | EN_DF_TYPE { DFT_UNKNOWN = 0, DFT_ARFF, DFT_CSV } |
Data File type (format) More... | |
enum | EN_ERRMSG { ERR_MF_NOREMOVE, ERR_MF_BAD_TYPE, ERR_MF_BAD_INDEX, ERR_MF_NO_POINT, ERR_MF_NOT_VALID, ERR_MF_NAME_NOT_FOUND, ERR_MF_CANT_ADD_POINT, ERR_MF_INVALID_VALUE, ERR_RULE_BAD_INDEX, ERR_RULE_NO_TERMS, ERR_RULE_NO_OUTPUT_VAL, ERR_RULE_BAD_TYPE, ERR_RULE_INVALID_OP, ERR_RULE_TS_COEFFS, ERR_RULE_NAME_NOT_FOUND, ERR_MFSET_NOT_VALID, ERR_MFSET_BAD_INDEX, ERR_MFSET_NONAME, ERR_MFSET_INVALID_NB, ERR_MFSET_NOT_ENOUGH_POINTS, ERR_MFSET_EMPTY, ERR_FIS_NOTVALID, ERR_FIS_BAD_TYPE, ERR_FIS_EVAL_UNABLE, ERR_FIS_DEFUZZ_UNABLE, ERR_DATA_BAD_INDEX, ERR_DATA_NO_DESCRIPTION, ERR_DATA_BAD_TYPE, ERR_DATA_NO_NUMERIC, ERR_DATA_NO_POINTS, ERR_DATA_INFO_INVALID, ERR_DATA_DESCR_INVALID, ERR_RULEBASE_NO_POINTERS, ERR_INPUTS_BAD_INDEX, ERR_BAD_INPUT_SIZE, ERR_NO_INPUTS, ERR_IO_ERROR, ERR_BAD_VALUES, ERR_PLOT_NOSCALE, ERR_PLOT_DRAW, ERR_GAPI, ERR_GAPI_NO_SCALE, ERR_UNKNOWN, ERR_DUMMY } |
Error codes used internally, a clean message will be written for the user in log file by SLIFIS::P_UserError() More... | |
enum | EN_FUNCSPACING { FS_LIN = 0, FS_LOG, FS_LOGREV, FS_GAUSS, FS_DUMMY } |
Used for defining the spacing of function built automatically using a min and max value. More... | |
enum | EN_MF_TYPE { MF_EMPTY = 0, MF_HL, MF_LH, MF_LL, MF_TRI, MF_GAUSS } |
Type of input membership function, only 4 allowed at present. More... | |
enum | EN_FIS_TYPE { TYPE_MAMDANI = 0, TYPE_SUGENO } |
Type of FIS, stored in SLIFIS::_FisType. More... | |
enum | EN_DEFUZZMETHOD { DF_COG = 0, DF_COA, DF_MAX, DF_MEMAX, DF_WMEMAX, DF_DUMMY } |
Defuzzification method. More... | |
enum | EN_FF_TYPE { IO_BIN = 0, IO_XML, IO_FCL, IO_UNKNOWN } |
FIS File type (I/O format), see SLIFIS::Read() and SLIFIS::Write() More... | |
enum | EN_AUTO_FILE_FORMAT { AUTO_EXT_OFF = 0, AUTO_EXT_ON } |
enum used to add auto-format selection from filename when using SLIFIS::Read() and SLIFIS::Write() More... | |
enum | EN_FIS_CHECKING { EN_FIS_CHECKING_YES = 0, EN_FIS_CHECKING_NO } |
enum used for doing (or not doing) checking of fis validity upon reading. See SLIFIS::Read() More... | |
enum | EN_RULE_OP { OPR_AND = 0, OPR_OR } |
Type of aggregation of terms of a rule see RULE, ROOT_RULE, RULE_IDX. More... | |
enum | EN_MERGE_OP { OPM_MIN = 0, OPM_MAX, OPM_PRODUCT, OPM_BSUM, OPM_PSUM, OPM_LUKAS, OPM_INVALID } |
Type of merging operations, see Binary operations and FuzzyMerge() More... | |
enum | EN_TNORM { TN_MIN, TN_PROD, TN_LUKA } |
Available T-Norms, these map to slifis::EN_MERGE_OP. More... | |
enum | EN_SNORM { SN_MAX, SN_BSUM, SN_PSUM } |
Available S-Norms, these map to slifis::EN_MERGE_OP. More... | |
enum | EN_REDUCE_METHOD { REDM_HIGHEST = 0, REDM_HIGHEST_NBRULES, REDM_HIGHEST_SUM, REDM_DUMMY } |
Method used for reducing nb of rules, in a "learning rules from data" situation. More... | |
Functions | |
char | GetChar_FieldType (EN_DATA_FIELD_TYPE type) |
Returns a significant character, showing the type of the data field (attribute) | |
const char * | GetString (EN_DF_TYPE type) |
Returns a string giving in plain text the FIS type. | |
const char * | GetString (EN_ERRMSG err) |
Returns as plain text the message error corresponding to err . | |
SLIFIS_STREAM_OP (FPOINT) | |
Overloading of operator <<. | |
SLIFIS_STREAM_OP (FUZZYVAL) | |
Friend function (operator <<) of class FUZZYVAL. | |
void | P_FindIntersectionPoints (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Finds all intersection points between f1 and f2 , and adds them to out . | |
void | P_ProcessPoints (const MEMBFUNC &fa, const MEMBFUNC &fb, MEMBFUNC &out, EN_MERGE_OP op) |
Considers all points of fa and fb , and adds them to out . Local function, not exported. | |
void | P_FindLowestFunction (const MEMBFUNC *f1, const MEMBFUNC *f2, const MEMBFUNC **f_L, const MEMBFUNC **f_R) |
Returns in f_L a pointer on the function f1 or f2, the one that first point is the lowest, and in f_R the other one. | |
static void | PrintDifferences (FILE *f, const RULE_BASE &rb1, const RULE_BASE &rb2) |
Prints in f the differences between the two rule bases. | |
static void | PrintDifferences (FILE *f, const FUZZY_ROOT &set1, const FUZZY_ROOT &set2) |
Prints in f the differences between the two sets of functions. | |
void | FuzzyMerge (EN_MERGE_OP op, const MEMBFUNC &in1, const MEMBFUNC &in2, MEMBFUNC &out) |
A wrapper functions for combining two membership function together, using slifis::EN_MERGE_OP. | |
void | FuzzyBSum (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Performs bounded sum between two functions ( ) | |
void | FuzzyPSum (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Performs Probabilistic sum between two functions ( ) | |
void | FuzzyLukas (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Performs Łukasiewicz t-norm between two functions ( ) | |
void | FuzzyProduct (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Performs fuzzy product between two functions. | |
void | FuzzyMin (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Performs fuzzy MIN between two functions. | |
void | FuzzyMax (const MEMBFUNC &f1, const MEMBFUNC &f2, MEMBFUNC &out) |
Performs fuzzy MAX between two functions. | |
size_t | P_FIP_OneSide (const MEMBFUNC *f1, const MEMBFUNC *f2, MEMBFUNC *out) |
Finds all intersection points between f1 and f2 , and adds them to out . | |
void | P_Process_OneSide (const MEMBFUNC &fa, const MEMBFUNC &fb, MEMBFUNC &out, EN_MERGE_OP op) |
Consider all points of fa , and compare to y value of fb . Add point to out if operation op tells to do so. | |
void | P_AddPointIfInInterval (MEMBFUNC *out, REALVAL x, FUZZYVAL y, REALVAL x1, REALVAL x2) |
Local function, not exported. | |
const char * | GetNow_String () |
A function for returning current date. | |
void | PrintBuildInfo (std::ostream &st) |
Prints out build information in stream st . | |
void | PrintDifferences (FILE *f, const SLIFIS &fis1, const SLIFIS &fis2) |
Prints in f the differences between the two FIS. | |
void | TrimCR (std::string &buf) |
Remove potential CR (0x0d) at end of string. Happens when reading a Windows generated file on a linux machine :-(. | |
void | TrimString (std::string &t, const std::string &chars) |
Remove from string t all leading characters belonging to chars . | |
std::vector< std::string > | TokensList (const std::string &input, char delim) |
A function that returns a STL vector of strings, filled with the tokens of input using delim as delimitor (needs BOOST) | |
bool | LineHasContent (const std::string &buf, const char *comment_chars) |
Returns true if line buf seems to hold something, false if line is empty or if line starts with one of the character in the string comment_chars . | |
EN_FF_TYPE | GetTypeFromFilename (std::string &filename) |
Determines the format of file I/O from filename extension. | |
const char * | GetString (EN_RULE_OP optype) |
Returns a string giving in plain text the rule operation type. | |
const char * | GetString (EN_MERGE_OP optype) |
Returns a string giving in plain text the merging operation type. | |
const char * | GetString (EN_SNORM norm) |
const char * | GetString (EN_TNORM norm) |
const char * | GetString (EN_FIS_TYPE type) |
Returns a string giving in plain text the FIS type. | |
const char * | GetString (EN_DEFUZZMETHOD m) |
Returns a string giving in plain text the defuzzification method m . | |
const char * | GetString (EN_REDUCE_METHOD method) |
Returns a string giving the rule base reducing method. | |
bool | rule2_cmp2 (const RULE_IDX &a, const RULE_IDX &b) |
Alternate comparison function, sorts rule by considering first output function index, and second the rule terms, as defined by slifis::RULE_IDX::operator<() | |
bool | PremisesAreEqual (const RULE_IDX &r1, const RULE_IDX &r2) |
Returns true id the antecedent part of rules are equal. | |
void | PrintDifferences (FILE *f, const RULE_IDX &r1, const RULE_IDX &r2) |
Prints in f the differences between the two rules. | |
SLIFIS_STREAM_OP (RULE_IDX) | |
Overloading of operator <<. | |
std::string | g_current_bin_file_format ("bin_1.2") |
a global string used to define the current binary file format. | |
std::string | g_current_xml_file_format ("xml_1.2") |
a global string used to define the current xml file format. |
This namespace includes all root classes, functions, and datatypes of the library.
typedef double slifis::NUM_TYPE |
size of numerical values for DATA_POINT_NUM, switch to float and rebuild if memory issues.
typedef boost::shared_ptr<VALUE> slifis::VALUE_PTR |
typedef std::pair< std::string, size_t > slifis::PAIR_STRING_COUNT |
A type using for storing the string-attribute value and its associated counter, see class DATA_SET.
typedef std::pair< std::string, EN_DATA_FIELD_TYPE > slifis::PAIR_ATTRIB_NT |
A type using for storing the attributes names and types.
typedef uchar slifis::RULE_NBFUNC_SIZE |
Datatype for the indexes of membership functions, possibles values are uchar, uint, ...
For example, in the rule "if input 'a' is 'b' and ... ":
uchar means you have 256 possible membership functions on each variable, if not enough, switch to ushort, or uint
typedef uchar slifis::RULE_NBVAR_SIZE |
Datatype for the indexes of input/output variables, possibles values are uchar, uint, ...
uchar means you have 256 possible inputs, if not enough, switch to ushort, or uint
typedef std::map<RULE_NBVAR_SIZE, RULE_NBFUNC_SIZE> slifis::RULE_IDX_TERM |
This is an alias for an STL map container, that holds pairs of indexes, one on the input variable, one on the membership function.
typedef double slifis::REALVAL |
Any real value.
typedef unsigned char slifis::uchar |
Used for retrieving Min/Max value of a dataset.
enum slifis::EN_DF_TYPE |
Data File type (format)
enum slifis::EN_ERRMSG |
Error codes used internally, a clean message will be written for the user in log file by SLIFIS::P_UserError()
ERR_MF_NOREMOVE |
Happens when trying to remove a point from a function that only has 2 points. |
ERR_MF_BAD_TYPE |
used in 3 MEMBFUNC::Set() functions |
ERR_MF_BAD_INDEX |
Happens when requesting an index in a MEMBFUNC object that doesn't have this index. |
ERR_MF_NO_POINT |
Requesting point in MEMBFUNC object, but function is empty. |
ERR_MF_NOT_VALID |
MEMBFUNC object not valid. |
ERR_MF_NAME_NOT_FOUND |
name of MF given in rule not found in set of MF |
ERR_MF_CANT_ADD_POINT |
point is too close from another |
ERR_MF_INVALID_VALUE |
Invalid value for x value when fuzzyfying. |
ERR_RULE_BAD_INDEX |
Happens when requesting an index in a RULE_IDX object that doesn't have this index. |
ERR_RULE_NO_TERMS | |
ERR_RULE_NO_OUTPUT_VAL |
rule has not output value |
ERR_RULE_BAD_TYPE |
Rules are not compatible. |
ERR_RULE_INVALID_OP |
Invalid operator in rule. |
ERR_RULE_TS_COEFFS | |
ERR_RULE_NAME_NOT_FOUND |
Used when translating from RULE to RULE_IDX, in case there is no corresponding variable name. |
ERR_MFSET_NOT_VALID |
set of functions is not valid |
ERR_MFSET_BAD_INDEX |
Happens when requesting an index in a FUZZY_IN or FUZZY_OUT object that doesn't have this index. |
ERR_MFSET_NONAME |
Can't find set of functions with requested name. |
ERR_MFSET_INVALID_NB |
Too much or not enough functions in a set when automatically building a set. |
ERR_MFSET_NOT_ENOUGH_POINTS |
Not enough points for automatic building of points. |
ERR_MFSET_EMPTY | |
ERR_FIS_NOTVALID | |
ERR_FIS_BAD_TYPE | |
ERR_FIS_EVAL_UNABLE | |
ERR_FIS_DEFUZZ_UNABLE | |
ERR_DATA_BAD_INDEX |
Error on data-related indexes. |
ERR_DATA_NO_DESCRIPTION | |
ERR_DATA_BAD_TYPE | |
ERR_DATA_NO_NUMERIC | |
ERR_DATA_NO_POINTS | |
ERR_DATA_INFO_INVALID | |
ERR_DATA_DESCR_INVALID | |
ERR_RULEBASE_NO_POINTERS |
happens when a rule base is build "alone" (i.e. with no relation to a FIS), and that a request on the input or output set is made (see RULE_BASE::GetInputSet() and RULE_BASE::GetOutputSet() ) |
ERR_INPUTS_BAD_INDEX | |
ERR_BAD_INPUT_SIZE |
This error means you tried to fill input values or rule base with a std::vector of values, and the size of the vector did not match the numer of inputs. |
ERR_NO_INPUTS |
Trying to add a rule, but no inputs to refer to. |
ERR_IO_ERROR |
I/O file error. |
ERR_BAD_VALUES |
used in MEMBFUNC::Set() functions, and in some FUZZY_ROOT 'Set()' functions (see fuzzy_root.cpp) |
ERR_PLOT_NOSCALE |
A scale of a plot has been requested, but none available (slifis_gapi only) |
ERR_PLOT_DRAW |
An image of the plot has been requested, but unable to draw. |
ERR_GAPI |
backend library error |
ERR_GAPI_NO_SCALE | |
ERR_UNKNOWN |
temp, should be removed in next releases |
ERR_DUMMY |
??? |
Used for defining the spacing of function built automatically using a min and max value.
FS_LIN |
Linear spacing. |
FS_LOG |
Log spacing. |
FS_LOGREV |
Reverse log spacing (not implemented yet) |
FS_GAUSS |
??? (not implemented yet), related with slifis::MF_GAUSS |
FS_DUMMY |
enum slifis::EN_MF_TYPE |
Type of input membership function, only 4 allowed at present.
Used in constructor of MEMBFUNC only, this information is not stored into the class because a function can change over time, points can be added or removed.
MF_EMPTY | |
MF_HL |
High to Low, 2 values needed. |
MF_LH |
Low to High, 2 values needed. |
MF_LL |
Low to Low (Trapezoidal, 4 values needed) |
MF_TRI |
Triangular function, 3 values needed. |
MF_GAUSS |
Gaussian approximation with 6 line segments, see Gaussian function approximation. |
enum slifis::EN_FIS_TYPE |
Type of FIS, stored in SLIFIS::_FisType.
To get a string value, see Enumeration to string functions.
Defuzzification method.
See http://en.wikipedia.org/wiki/Defuzzification for more methods to implement
To get a string value from this enum, see Enumeration to string functions.
enum slifis::EN_FF_TYPE |
FIS File type (I/O format), see SLIFIS::Read() and SLIFIS::Write()
enum used to add auto-format selection from filename when using SLIFIS::Read() and SLIFIS::Write()
enum used for doing (or not doing) checking of fis validity upon reading. See SLIFIS::Read()
enum slifis::EN_RULE_OP |
Type of aggregation of terms of a rule see RULE, ROOT_RULE, RULE_IDX.
To get a string value from this enum, see Enumeration to string functions.
enum slifis::EN_MERGE_OP |
Type of merging operations, see Binary operations and FuzzyMerge()
To get a string value from this enum, see Enumeration to string functions.
enum slifis::EN_TNORM |
Available T-Norms, these map to slifis::EN_MERGE_OP.
enum slifis::EN_SNORM |
Available S-Norms, these map to slifis::EN_MERGE_OP.
Method used for reducing nb of rules, in a "learning rules from data" situation.
For string printing, see Enumeration to string functions.
char slifis::GetChar_FieldType | ( | EN_DATA_FIELD_TYPE | type | ) |
Returns a significant character, showing the type of the data field (attribute)
a free function to get a char identifier of the data type
References DT_DATE, DT_DEFAULT, DT_NUMERIC, DT_STRING, DT_STRING_INDEX, and SWITCH_ERROR.
Referenced by slifis::DATASET_PROPERTIES::Print(), and slifis::DATAFILE_INFO::Print().
const char * slifis::GetString | ( | EN_DF_TYPE | type | ) |
Returns a string giving in plain text the FIS type.
Stays in this file (and not in helper_functions.cpp like the other "_String()" functions) to reduce dependencies between the core fuzzy library and the "data" oriented part of the library.
See Enumeration to string functions
References DFT_ARFF, DFT_CSV, DFT_UNKNOWN, and SWITCH_ERROR.
Referenced by main(), slifis::SLIFIS::P_Read_XML(), slifis::SLIFIS::P_Write_FCL(), slifis::RULE_IDX::P_Write_XML(), slifis::SLIFIS::P_Write_XML(), slifis::INF_PARAMS::Print(), slifis::RULE_BASE::Print(), slifis::SLIFIS::Print(), slifis::DATA_POINT::Print(), slifis::RULE_BASE::Print2(), PrintDifferences(), slifis::ROOT_RULE::SetFisType(), and slifis::ERROR_HANDLER::what().
const char * slifis::GetString | ( | EN_ERRMSG | err | ) |
Returns as plain text the message error corresponding to err
.
See Enumeration to string functions
References ERR_BAD_INPUT_SIZE, ERR_BAD_VALUES, ERR_DATA_BAD_INDEX, ERR_DATA_BAD_TYPE, ERR_DATA_DESCR_INVALID, ERR_DATA_INFO_INVALID, ERR_DATA_NO_DESCRIPTION, ERR_DATA_NO_NUMERIC, ERR_DATA_NO_POINTS, ERR_FIS_BAD_TYPE, ERR_FIS_DEFUZZ_UNABLE, ERR_FIS_EVAL_UNABLE, ERR_FIS_NOTVALID, ERR_GAPI, ERR_GAPI_NO_SCALE, ERR_INPUTS_BAD_INDEX, ERR_IO_ERROR, ERR_MF_BAD_INDEX, ERR_MF_BAD_TYPE, ERR_MF_CANT_ADD_POINT, ERR_MF_INVALID_VALUE, ERR_MF_NAME_NOT_FOUND, ERR_MF_NO_POINT, ERR_MF_NOREMOVE, ERR_MF_NOT_VALID, ERR_MFSET_BAD_INDEX, ERR_MFSET_EMPTY, ERR_MFSET_INVALID_NB, ERR_MFSET_NONAME, ERR_MFSET_NOT_ENOUGH_POINTS, ERR_MFSET_NOT_VALID, ERR_NO_INPUTS, ERR_PLOT_DRAW, ERR_PLOT_NOSCALE, ERR_RULE_BAD_INDEX, ERR_RULE_BAD_TYPE, ERR_RULE_INVALID_OP, ERR_RULE_NAME_NOT_FOUND, ERR_RULE_NO_OUTPUT_VAL, ERR_RULE_NO_TERMS, ERR_RULE_TS_COEFFS, ERR_RULEBASE_NO_POINTERS, ERR_UNKNOWN, and SWITCH_ERROR.
slifis::SLIFIS_STREAM_OP | ( | FPOINT | ) |
Overloading of operator <<.
slifis::SLIFIS_STREAM_OP | ( | FUZZYVAL | ) |
Friend function (operator <<) of class FUZZYVAL.
void slifis::P_FindIntersectionPoints | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Finds all intersection points between f1
and f2
, and adds them to out
.
out
is cleared, its size is the number of intersections foundThe function needs to call twice the "real" code (P_FIP_OneSide() ), because this latter function parses only one of the two membership functions, searching for intersections, and there can be some intersections AFTER the last point of the first MF.
References __IN__, __OUT__, slifis::MEMBFUNC::Clear(), P_FIP_OneSide(), and slifis::MEMBFUNC::P_RemoveDuplicates().
Referenced by FuzzyBSum(), FuzzyLukas(), FuzzyMax(), FuzzyMin(), FuzzyProduct(), and FuzzyPSum().
void slifis::P_ProcessPoints | ( | const MEMBFUNC & | fa, |
const MEMBFUNC & | fb, | ||
MEMBFUNC & | out, | ||
EN_MERGE_OP | op | ||
) |
Considers all points of fa
and fb
, and adds them to out
. Local function, not exported.
fa
, and compare to y value of fb
fb
, and compare to y value of fa
References __IN__, __OUT__, P_Process_OneSide(), and slifis::MEMBFUNC::P_RemoveDuplicates().
Referenced by FuzzyBSum(), FuzzyLukas(), FuzzyMax(), FuzzyMin(), FuzzyProduct(), and FuzzyPSum().
void slifis::P_FindLowestFunction | ( | const MEMBFUNC * | f1, |
const MEMBFUNC * | f2, | ||
const MEMBFUNC ** | f_L, | ||
const MEMBFUNC ** | f_R | ||
) |
Returns in f_L a pointer on the function f1 or f2, the one that first point is the lowest, and in f_R the other one.
References __IN__, __OUT__, slifis::MEMBFUNC::GetFirstPoint(), slifis::FPOINT::GetX(), and slifis::MEMBFUNC::IsEmpty().
void slifis::PrintDifferences | ( | FILE * | f, |
const RULE_BASE & | rb1, | ||
const RULE_BASE & | rb2 | ||
) | [static] |
Prints in f
the differences between the two rule bases.
References slifis::RULE_BASE::GetNbRules(), slifis::RULE_BASE::GetRule(), and slifis::RULE_IDX::Print().
Referenced by PrintDifferences().
void slifis::PrintDifferences | ( | FILE * | f, |
const FUZZY_ROOT & | set1, | ||
const FUZZY_ROOT & | set2 | ||
) | [static] |
Prints in f
the differences between the two sets of functions.
References slifis::FUZZY_ROOT::GetMf(), slifis::FUZZY_ROOT::GetNbMf(), and slifis::MEMBFUNC::Print().
void slifis::FuzzyMerge | ( | EN_MERGE_OP | op, |
const MEMBFUNC & | in1, | ||
const MEMBFUNC & | in2, | ||
MEMBFUNC & | out | ||
) |
A wrapper functions for combining two membership function together, using slifis::EN_MERGE_OP.
References FuzzyBSum(), FuzzyLukas(), FuzzyMax(), FuzzyMin(), FuzzyProduct(), FuzzyPSum(), OPM_BSUM, OPM_LUKAS, OPM_MAX, OPM_MIN, OPM_PRODUCT, OPM_PSUM, and SWITCH_ERROR.
Referenced by main().
void slifis::FuzzyBSum | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Performs bounded sum between two functions ( )
References __IN__, __OUT__, slifis::MEMBFUNC::Cleanup(), slifis::MEMBFUNC::Clear(), slifis::MEMBFUNC::Fuzzify(), slifis::MEMBFUNC::GetMinValue(), slifis::MEMBFUNC::GetNbPoints(), slifis::MEMBFUNC::GetPoint(), slifis::FPOINT::GetX(), slifis::MEMBFUNC::IsEmpty(), slifis::MEMBFUNC::ModifyPoint(), OPM_BSUM, P_FindIntersectionPoints(), and P_ProcessPoints().
Referenced by FuzzyMerge(), and slifis::SLIFIS::P_Evaluate_M().
void slifis::FuzzyPSum | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Performs Probabilistic sum between two functions ( )
References __IN__, __OUT__, slifis::MEMBFUNC::Cleanup(), slifis::MEMBFUNC::Clear(), slifis::MEMBFUNC::Fuzzify(), slifis::MEMBFUNC::GetMinValue(), slifis::MEMBFUNC::GetNbPoints(), slifis::MEMBFUNC::GetPoint(), slifis::FPOINT::GetX(), slifis::MEMBFUNC::IsEmpty(), slifis::MEMBFUNC::ModifyPoint(), OPM_PSUM, P_FindIntersectionPoints(), and P_ProcessPoints().
Referenced by FuzzyMerge(), and slifis::SLIFIS::P_Evaluate_M().
void slifis::FuzzyLukas | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Performs Łukasiewicz t-norm between two functions ( )
References __IN__, __OUT__, slifis::MEMBFUNC::Cleanup(), slifis::MEMBFUNC::Clear(), slifis::MEMBFUNC::Fuzzify(), slifis::MEMBFUNC::GetMinValue(), slifis::MEMBFUNC::GetNbPoints(), slifis::MEMBFUNC::GetPoint(), slifis::FPOINT::GetX(), slifis::MEMBFUNC::IsEmpty(), slifis::MEMBFUNC::ModifyPoint(), OPM_LUKAS, P_FindIntersectionPoints(), and P_ProcessPoints().
Referenced by FuzzyMerge().
void slifis::FuzzyProduct | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Performs fuzzy product between two functions.
out = in1 * in2
in1
and in2
cannot be used as out
References __IN__, __OUT__, slifis::MEMBFUNC::Cleanup(), slifis::MEMBFUNC::Clear(), slifis::MEMBFUNC::Fuzzify(), slifis::MEMBFUNC::GetMinValue(), slifis::MEMBFUNC::GetNbPoints(), slifis::MEMBFUNC::GetPoint(), slifis::FPOINT::GetX(), slifis::MEMBFUNC::IsEmpty(), slifis::MEMBFUNC::ModifyPoint(), OPM_PRODUCT, P_FindIntersectionPoints(), and P_ProcessPoints().
Referenced by FuzzyMerge(), and main().
void slifis::FuzzyMin | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Performs fuzzy MIN between two functions.
in1
and in2
cannot be used as out
References __IN__, __OUT__, slifis::MEMBFUNC::Cleanup(), slifis::MEMBFUNC::Clear(), slifis::MEMBFUNC::GetMinValue(), slifis::MEMBFUNC::IsEmpty(), OPM_MIN, P_FindIntersectionPoints(), and P_ProcessPoints().
Referenced by FuzzyMerge(), and main().
void slifis::FuzzyMax | ( | const MEMBFUNC & | f1, |
const MEMBFUNC & | f2, | ||
MEMBFUNC & | out | ||
) |
Performs fuzzy MAX between two functions.
in1
and in2
cannot be used as out
References __IN__, __OUT__, slifis::MEMBFUNC::Cleanup(), slifis::MEMBFUNC::Clear(), slifis::MEMBFUNC::GetMaxValue(), slifis::MEMBFUNC::IsEmpty(), OPM_MAX, P_FindIntersectionPoints(), and P_ProcessPoints().
Referenced by FuzzyMerge(), main(), and slifis::SLIFIS::P_Evaluate_M().
size_t slifis::P_FIP_OneSide | ( | const MEMBFUNC * | f1, |
const MEMBFUNC * | f2, | ||
MEMBFUNC * | out | ||
) |
Finds all intersection points between f1
and f2
, and adds them to out
.
Algorithm:
- For each segment s_i of function f1
- count how many points n of f2 lie in the x-interval of segment s_i, and fetch their index values id1 and id2
- IF n!=0
- Build segment s_j made of f2(id1) and f2(id1-1) (or horizontal line if id1=0)
- IF s_j intersects with s_i
- Add intersection point
- ENDIF
- FOR each point j of f2 from id1 to id2
- Build segment s_j made of f2(j) and f2(j+1) (or horizontal line if j is last point of f2)
- IF s_i intersects s_j
- Add intersection point
- ENDIF
- ENDFOR
- ELSE (n=0)
- compute the segment s_k of f2 in the x-range of s_i
- IF s_k and s_i intersect
- add intersection point
- ENDIF
- ENDIF
- ENDFOR
References __IN__, __OUT__, slifis::MEMBFUNC::Fuzzify(), slifis::MEMBFUNC::GetFirstPoint(), slifis::MEMBFUNC::GetLeftValue(), slifis::MEMBFUNC::GetNbPoints(), slifis::MEMBFUNC::GetPoint(), slifis::MEMBFUNC::GetRightValue(), slifis::FPOINT::GetX(), slifis::FPOINT::GetY(), slifis::MEMBFUNC::P_AddPoint(), P_AddPointIfInInterval(), slifis::MEMBFUNC::P_GetIntervalPointsVector(), slifis::MEMBFUNC::Print(), and SLIFIS_DEBUG_LOG.
Referenced by P_FindIntersectionPoints().
void slifis::P_Process_OneSide | ( | const MEMBFUNC & | fa, |
const MEMBFUNC & | fb, | ||
MEMBFUNC & | out, | ||
EN_MERGE_OP | op | ||
) |
Consider all points of fa
, and compare to y value of fb
. Add point to out
if operation op
tells to do so.
References __IN__, __OUT__, slifis::MEMBFUNC::Fuzzify(), slifis::MEMBFUNC::GetNbPoints(), slifis::MEMBFUNC::GetPoint(), slifis::FPOINT::GetX(), slifis::FPOINT::GetY(), OPM_BSUM, OPM_LUKAS, OPM_MAX, OPM_MIN, OPM_PRODUCT, OPM_PSUM, slifis::MEMBFUNC::P_AddPoint(), and SWITCH_ERROR.
Referenced by P_ProcessPoints().
void slifis::P_AddPointIfInInterval | ( | MEMBFUNC * | out, |
REALVAL | x, | ||
FUZZYVAL | y, | ||
REALVAL | x1, | ||
REALVAL | x2 | ||
) |
Local function, not exported.
out
if real value x
is stricly higher than x1
and strictly lower than x2
References __IN__, __OUT__, and slifis::MEMBFUNC::P_AddPoint().
Referenced by P_FIP_OneSide().
const char * slifis::GetNow_String | ( | ) |
A function for returning current date.
Included here for practical reasons, as I didn't want to create a file just for this, and this current file (it's header, actually) is one of the highest in the tree of includes.
Referenced by slifis::SLIFIS::P_Write_FCL(), and slifis::SLIFIS::P_Write_XML().
void slifis::PrintBuildInfo | ( | std::ostream & | st | ) |
void slifis::PrintDifferences | ( | FILE * | f, |
const SLIFIS & | fis1, | ||
const SLIFIS & | fis2 | ||
) |
Prints in f
the differences between the two FIS.
References slifis::SLIFIS::_InputFuzzySets, slifis::INPUT_SETS::GetMfSet(), slifis::SLIFIS::GetNbInputs(), slifis::SLIFIS::GetOutputSet(), slifis::SLIFIS::GetRuleBase(), GetString(), slifis::SLIFIS::GetType(), and PrintDifferences().
void slifis::TrimCR | ( | std::string & | buf | ) |
Remove potential CR (0x0d) at end of string. Happens when reading a Windows generated file on a linux machine :-(.
Referenced by slifis::DATAFILE_INFO::P_GetFileInfo_arff(), slifis::DATAFILE_INFO::P_GetFileInfo_csv(), and slifis::DATA_POINT::ReadDataFields().
void slifis::TrimString | ( | std::string & | t, |
const std::string & | chars | ||
) |
Remove from string t
all leading characters belonging to chars
.
Referenced by TokensList().
std::vector< std::string > slifis::TokensList | ( | const std::string & | input, |
char | delim | ||
) |
A function that returns a STL vector of strings, filled with the tokens of input
using delim
as delimitor (needs BOOST)
This function also trims leading spaces
input | The input string |
delim | the delimiter character |
References TrimString().
Referenced by GetTypeFromFilename(), slifis::DATAFILE_INFO::P_FetchArffCommands(), slifis::DATAFILE_INFO::P_GetFileInfo_csv(), slifis::DATA_POINT::ReadDataFields(), and slifis::DATA_DESCR::SetInputColumns().
bool slifis::LineHasContent | ( | const std::string & | buf, |
const char * | comment_chars | ||
) |
Returns true if line buf
seems to hold something, false if line is empty or if line starts with one of the character in the string comment_chars
.
Referenced by slifis::DATAFILE_INFO::P_GetFileInfo_arff(), slifis::DATAFILE_INFO::P_GetFileInfo_csv(), and slifis::DATA_POINT::ReadDataFields().
EN_FF_TYPE slifis::GetTypeFromFilename | ( | std::string & | filename | ) |
Determines the format of file I/O from filename extension.
References IO_BIN, IO_FCL, IO_UNKNOWN, IO_XML, SLIFIS_ERROR_LOG, and TokensList().
Referenced by slifis::SLIFIS::Read(), and slifis::SLIFIS::Write().
const char * slifis::GetString | ( | EN_RULE_OP | optype | ) |
Returns a string giving in plain text the rule operation type.
See Enumeration to string functions
References OPR_AND, OPR_OR, and SWITCH_ERROR.
const char * slifis::GetString | ( | EN_MERGE_OP | optype | ) |
Returns a string giving in plain text the merging operation type.
See Enumeration to string functions
References OPM_BSUM, OPM_LUKAS, OPM_MAX, OPM_MIN, OPM_PRODUCT, OPM_PSUM, and SWITCH_ERROR.
const char * slifis::GetString | ( | EN_SNORM | norm | ) |
References SN_BSUM, SN_MAX, SN_PSUM, and SWITCH_ERROR.
const char * slifis::GetString | ( | EN_TNORM | norm | ) |
References SWITCH_ERROR, TN_LUKA, TN_MIN, and TN_PROD.
const char * slifis::GetString | ( | EN_FIS_TYPE | type | ) |
Returns a string giving in plain text the FIS type.
See Enumeration to string functions
References TYPE_MAMDANI.
const char * slifis::GetString | ( | EN_DEFUZZMETHOD | m | ) |
Returns a string giving in plain text the defuzzification method m
.
See Enumeration to string functions
References DF_COA, DF_COG, DF_MAX, DF_MEMAX, DF_WMEMAX, and SWITCH_ERROR.
const char * slifis::GetString | ( | EN_REDUCE_METHOD | method | ) |
Returns a string giving the rule base reducing method.
See Learning rules from data and Enumeration to string functions
References REDM_HIGHEST, REDM_HIGHEST_NBRULES, REDM_HIGHEST_SUM, and SWITCH_ERROR.
bool slifis::rule2_cmp2 | ( | const RULE_IDX & | a, |
const RULE_IDX & | b | ||
) |
Alternate comparison function, sorts rule by considering first output function index, and second the rule terms, as defined by slifis::RULE_IDX::operator<()
References slifis::RULE_IDX::_OutputMf, and slifis::RULE_IDX::GetNbTerms().
bool slifis::PremisesAreEqual | ( | const RULE_IDX & | r1, |
const RULE_IDX & | r2 | ||
) |
Returns true id the antecedent part of rules are equal.
References slifis::RULE_IDX::_m_ini_mfi, slifis::ROOT_RULE::GetFisType(), slifis::RULE_IDX::GetNbTerms(), and slifis::ROOT_RULE::GetOpType().
Referenced by slifis::RULE_BASE::Reduce().
void slifis::PrintDifferences | ( | FILE * | f, |
const RULE_IDX & | r1, | ||
const RULE_IDX & | r2 | ||
) |
Prints in f
the differences between the two rules.
References FLOAT_ARE_EQUAL, slifis::ROOT_RULE::GetFisType(), slifis::RULE_IDX::GetNbTerms(), slifis::ROOT_RULE::GetOpType(), slifis::RULE_IDX::GetOutMfIndex(), slifis::ROOT_RULE::GetTSCoeff(), slifis::ROOT_RULE::GetTSConstCoeff(), slifis::ROOT_RULE::GetTSVectorSize(), and TYPE_MAMDANI.
slifis::SLIFIS_STREAM_OP | ( | RULE_IDX | ) |
Overloading of operator <<.
References OPR_AND, OPR_OR, SWITCH_ERROR, and TYPE_SUGENO.
std::string slifis::g_current_bin_file_format | ( | "bin_1.2" | ) |
a global string used to define the current binary file format.
This is needed for file I/O operations, to check if an app can safely open a file written using some previous version of the library. If value does not match, then you won't be able to open the file.
It will change only in case the file format changes.
History:
Referenced by slifis::SLIFIS::P_Read_bin(), and slifis::SLIFIS::P_Write_bin().
std::string slifis::g_current_xml_file_format | ( | "xml_1.2" | ) |
a global string used to define the current xml file format.
This is needed for file I/O operations, to check if an app can safely open a file written using some previous version of the library. If value does not match, then you won't be able to open the file.
It will change only in case the file format changes.
Referenced by slifis::SLIFIS::P_Read_XML(), and slifis::SLIFIS::P_Write_XML().