Inference refers to the process of fuzzy reasoning.

`inference(MF, rule, names.varinput, type.tnorm, type.snorm)`

MF

a matrix of the degrees of membership functions which is a result of the `fuzzifier`

.

rule

a matrix or list of fuzzy IF-THEN rules. See `rulebase`

.

names.varinput

a list of names of the input variables.

type.tnorm

a value which represents the type of t-norm to be used:

`1`

or`MIN`

means standard t-norm: \(min(x1, x2)\).`2`

or`HAMACHER`

means Hamacher product: \((x1 * x2)/(x1 + x2 - x1 * x2)\).`3`

or`YAGER`

means Yager class: \(1- min(1, ((1 - x1) + (1 - x2)))\).`4`

or`PRODUCT`

means product: \((x1 * x2)\).`5`

or`BOUNDED`

means bounded product: \(max(0, x1 + x2 - 1)\).

type.snorm

a value which represents the type of s-norm to be used:

`1`

or`MAX`

means standard s-norm: \(max(x1, x2)\).`2`

or`HAMACHER`

means Hamacher sum: \((x1 + x2 - 2x1 * x2) / 1 - x1 * x2\).`3`

or`YAGER`

means Yager class: \(min(1, (x1 + x2))\).`4`

or`SUM`

means sum: \((x1 + x2 - x1 * x2)\).`5`

or`BOUNDED`

means bounded sum: \(min(1, x1 + x2)\).

a matrix of the degrees of the rules.

In this function, fuzzy reasoning is conducted based on Mamdani and Takagi Sugeno Kang model. Furthermore, there are some formula for conjunction and disjunction operators.

**The Mamdani model:**
A fuzzy system with, e.g., two inputs \(x1\) and \(x2\) (antecedents) and a single output \(y\) (consequent)
is described by the following fuzzy IF-THEN rule:

`IF x1 is A1 and x2 is A2 THEN y is B`

where \(A1\) and \(A2\) are the fuzzy sets representing the antecent pairs and \(B\) is the fuzzy set representing the consequent.

**The Takagi Sugeno Kang model:**
Suppose we have two inputs \(x1\) and \(x2\) and output \(y\), then the fuzzy IF-THEN rule is as follows:

`IF x1 is A1 and x2 is A2 THEN y is y = f(x1, x2)`

where \(y = f(x1, x2)\) is a crisp function in the consequent part which is usually a polynomial function, and \(A1\) and \(A2\) are the fuzzy sets representing the antecent pairs.

Futhermore, this function has the following capabilities:

It supports unary operators (not) and binary operators (

`AND`

and`OR`

).It provides linguistic hedge (

`extremely`

,`very`

,`somewhat`

, and`slightly`

).there are several methods for the t-norm and s-norm.

`defuzzifier`

, `rulebase`

, and `fuzzifier`

.