C++ Neural Networks and Fuzzy Logic
by Valluru B. Rao M&T Books, IDG Books Worldwide, Inc. ISBN: 1558515526 Pub Date: 06/01/95 |
Previous | Table of Contents | Next |
In our example, we have just one output, which is the HeatKnob. We need to assign fuzzy memberships to this variable just as we did for the inputs. This is shown in Table 16.14 and Figure 16.5. We use different variable names to make the example clearer later on.
Crisp Input Range | Fuzzy Variable |
---|---|
02 | VeryLittle |
1.54 | ALittle |
37 | AGoodAmount |
68.5 | ALot |
7.510 | AWholeLot |
Figure 16.5 Fuzzy membership functions for the output HeatKnob.
Now that you have the inputs and the output defined in terms of fuzzy variables, you need only specify what actions to take under what conditions; that is, you need to construct a set of rules that describe the operation of the FLC. These rules usually take the form of IFTHEN rules and can be obtained from a human expert (heuristics), or can be supplied from a neural network that infers the rules from behavior of the system. We mentioned this idea in Chapter 3.
Let us construct a rule base for our design example. For the two inputs, we define the matrix shown in Table 16.15. Our heuristic guidelines in determining this matrix are the following statements and their converses:
NOTE: In FLCs, we do not need to specify all the boxes in the matrix. That is perfectly fine. No entry signifies that no action is taken, for example, in the column for SenseTemp=XL, no action is required since the temperature is already at or above the target temperature.
SenseTemp-> Sense Level | XS | S | M | L | XL |
---|---|---|---|---|---|
\/ | |||||
XS | AGoodAmount | ALittle | VeryLittle | ||
S | ALot | AGoodAmount | VeryLittle | VeryLittle | |
M | AWholeLot | ALot | AGoodAmount | VeryLittle | |
L | AWholeLot | ALot | ALot | ALittle | |
XL | AWholeLot | ALot | ALot | AGoodAmount | |
Let us examine a couple of typical entries in the table: For SenseLevel = Medium (M) and SenseTemp = XSmall (XS), the output is HeatKnob = AWholeLot. Now for the same temperature, as the water level rises, the setting on HeatKnob also should rise to compensate for the added volume of water. You can see that for SenseLevel = Large(L), and SenseTemp = XSmall(XS), the output is HeatKnob = AWholeLot. You can verify that the rest of the table is created by similar reasoning.
Creating IFTHEN Rules
We can now translate the table entries into IF - THEN rules. We take these directly from Table 16.15:
Remember that the output and inputs to the fuzzy rule base are fuzzy variables. For any given crisp input value, there may be fuzzy membership in several fuzzy input variables (determined by the fuzzification step). And each of these fuzzy input variable activations will cause different fuzzy output cells to fire, or be activated. This brings us to the final step, defuzzification of the output into a crisp value.
In order to control the HeatKnob, we need to obtain a crisp dial setting. So far, we have several of the IFTHEN rules of the fuzzy rule base firing at once, because the inputs have been fuzzified. How do we arrive at a single crisp output number ? There are actually several different strategies for this; we will consider two of the most common, the center of area (COA) or centroid method, and the fuzzy Or method. The easiest way to understand the process is with an example.
Previous | Table of Contents | Next |