## Ifthen rules

Fuzzy sets and fuzzy operators are the subjects and verbs of fuzzy logic. While the differential equations are the language of conventional control, if-then rules, which determine the way a process is controlled, are the language of fuzzy control. Fuzzy rules serve to describe the quantitative relationship between variables in linguistic terms. These if-then rule statements are used to formulate the conditional statements that comprise fuzzy logic. Several rule bases of different complexity can be developed, such as

IF Sensor 1 is Very Low AND Sensor 2 is Very Low THEN Motor is Fast Reverse

IF Sensor 1 is High AND Sensor 2 is Low THEN Motor is Slow Reverse

IF Sensor 1 is Okay AND Sensor 2 is Okay THEN Motor Off

IF Sensor 1 is Low AND Sensor 2 is High THEN Motor is Slow Forward

IF Sensor 1 is Very Low AND Sensor 2 is Very High THEN Motor is Fast Forward

In general form, a single fuzzy IF-THEN rule is of the form

where A, B, and C are linguistic values defined by fuzzy sets on the ranges (universe of discourse) X, Y, and Z, respectively. In if-then rules, the term following the IF statement is called the premise or antecedent, and the term following THEN is called the consequent.

It should be noted that A and B are represented as a number between 0 and 1, and so the antecedent is an interpretation that returns a single number between 0 and 1. On the other hand, C is represented as a fuzzy set, so the consequent is an assignment that assigns the entire fuzzy set C to the output variable z. In the if-then rule, the word is gets used in two entirely different ways, depending on whether it appears in the antecedent or the consequent. In general, the input to an if-then rule is the current value of an input variable, in Eq. (11.118), x and y, and the output is an entirely fuzzy set, in Eq. (11.118), z. This will later be defuzzified, assigning one value to the output.

Interpreting an if-then rule involves two distinct parts:

1. Evaluate the antecedent, which involves fuzzifying the input and applying any necessary fuzzy operators.

2. Apply that result to the consequent, known as implication.

In the case of two-valued or binary logic, if-then rules present little difficulty. If the premise is true, then the conclusion is true. In the case of a fuzzy statement, if the antecedent is true to some degree of membership, then the consequent is also true to that same degree; that is,

In binary logic, p ^ q (p and q are either both true or both false)

In fuzzy logic, 0.5p ^ 0.5q (partial antecedents provide partial implication)

It should be noted that both the antecedent and the consequent parts of a rule can have multiple components. For example, the antecedent part can be if temperature is high and sun is shining and pressure is falling, then ...

In this case, all parts of the antecedent are calculated simultaneously and resolved to a single number using the logical operators described previously. The consequent of a rule can also have multiple parts, for example, if temperature is very hot, then boiler valve is shut and public mains water valve is open

In this case, all consequents are affected equally by the result of the antecedent. The consequent specifies a fuzzy set assigned to the output. The implication function then modifies that fuzzy set to the degree specified by the antecedent. The most common way to modify the output set is truncation using the min function.

In general, interpreting if-then fuzzy rules is a three-part process:

1. Fuzzify inputs. All fuzzy statements in the antecedent are resolved to a degree of membership between 0 and 1.

2. Apply a fuzzy operator to multiple part antecedents. If there are multiple parts to the antecedent, apply fuzzy logic operators and resolve the antecedent to a single number between 0 and 1.

3. Apply the implication method. The degree of support for the entire rule is used to shape the output fuzzy set. The consequent of a fuzzy rule assigns an entire fuzzy set to the output. This fuzzy set is represented by a membership function that is chosen to indicate the quantities of the consequent. If the antecedent is only partially true, then the output fuzzy set is truncated according to the implication method.