Go to the previous, next section.

## FlFRuleBase -- Rule base and Fuzzy inference engine

### SYNOPSIS

`#include <FuzzyLib/FRuleBase.h>`

### TYPE

`Fl_FRULEBASE`

### BASE CLASSES

FlNamed

### DERIVED CLASSES

None

### RELATED CLASSES

None

### DESCRIPTION

Constructors:

`FlFRuleBase();`
`FlFRuleBase(FlParam *param);`
`FlFRuleBase(FlStringR name);`
  Initializes the `FlFRuleBase` with `name` as the object's name.

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

`void add_rule(FlFRule *rule);`
`void add_rule(FlFRule &rule);`
  Adds rule to base.

`void add_in_var(FlFVar *rule);`
`void add_in_var(FlFVar &rule);`
`void add_out_var(FlFVar *rule);`
`void add_out_var(FlFVar &rule);`
  Adds input/output variables to the base.

`int get_n_rules()const;`
`int get_n_in_vars()const;`
`int get_n_out_vars()const;`
  Returns the number of rules/input variables/output variables in this base.

`int resolution()const;`
  Returns the output fuzzy set resolution.

`void inference(FlFVar *var, FlFSet *set , double match, FlFSetArray &res);`
  Computes the inference set for variable `var` and value `set`, using value `match` of LHS aggregation. The result is stored in the array fuzzy set `res`.

`void evaluate(FlFVar *var, FlFSetArray &res);`
  Computes output set for variable `var`, combining the `inference()` results of all rules. The result is stored in the array fuzzy set `res`.

`void aggregate_all();`
  Aggregates all rules.

`void evaluate_all();`
  Evaluates all variables.

`void defuzzy_all();`
  Defuzzifies all output variables.

`Fl_bool updateFuzzySets(const char* filename);`
  Replaces the existing fuzzy sets with the sets specified in the file. It returns TRUE if the sets were updated, FALSE if there was a format error.

`void debug_rules(ostream &strm=cout, int lvl=0);`
  Debugs the output on `&strm` for fuzzy rules.

Go to the previous, next section.