**Fuzzy Rules**

Human beings make descisions based on rules. Even though, we may not be aware
of it, all the descisions we make are based on computer like
if-then statements. If the weather is fine, then we may decide to go out.
If the forecast says the weather will be bad today, but fine tommorow, then
we make a descision not to go today, and postpone it till tommorow. Rules associate ideas and relate one event to another.

Fuzzy machines, which always tend to mimick the behaviour of man, work the same
way. Only this time the descision and the means of choosing that descison are
replaced by fuzzy sets and the rules are replaced by fuzzy rules. Fuzzy rules
also operate using a series of if-then statements. For instance,
X then A, if y then b, where A and B are all sets of X and Y.
Fuzzy rules define fuzzy *patches*, which is the key idea in fuzzy logic.

A machine is made smarter using a concept
designed by Bart Kosko called the Fuzzy Approximation Theorem(FAT). The FAT theorem
generally states a finite number of patches can cover a curve as seen in
the figure below. If the patches
are large, then the rules are sloppy. If the patches are small then the rules are fine.

**Fuzzy Control**

Fuzzy control, which directly uses fuzzy rules is the most important application in fuzzy theory.
Using a procedure originated by Ebrahim Mamdani in the late 70s, three steps are taken
to create a fuzzy controlled machine:

The four results are overlaps and is reduced to the following figure

Step 3: The result of the fuzzy controller so far is a fuzzy set (of speed). To
choose an appropriate representative value as the final output(crisp values), defuzzification must be done.
This can be done in many ways, but the most common method used is the
center of gravity of the set as shown below.

This part of the article describes the design procedures of a real life application of fuzzy logic: A Smart Traffic Light Controller. The controller is suppose to change the cycle time depending upon the densities of cars behind green and red lights and the current cycle time.

*Background*

In a conventional traffic light controller, the lights change at constant cycle time, which
is clearly not the optimal solution. It would be more feasible to pass more cars at
the green interval if there are fewer cars waiting behind the red lights. Obviously, a mathematical
model for this decision is enormously difficult to find. However, with fuzzy
logic, it is relatively much easier.

*Fuzzy Design*

First, eight incremental sensors are put in specific positions as seen in the diagram below.

The first sensor behind each traffic light counts the number cars coming to the intersection
and the latter counts the cars passing the traffic lights. The amount of cars
between the traffic lights is determined by the difference of the reading of the two sensors.
For example, the number of cars behind traffic light North is s7-s8.

The disatnce D,
chosen to be 200ft., is used to determine the maximum density of cars allowed to
wait in a very crowded situation. This is done by adding the number of cars between
to paths and dividing it by the total distance. For instance, the number of cars between the East and West street is
(s1-s2)+(s5-s6)/400.

Next comes the fuzzy descision process which uses the three step mentioned above(fuzzyification,
rule evaluation and defuzzification).

*Step 1*

As before, firstly the inputs and outputs
of the design has to be determined. Assuming red light is shown to both
North and South streets and distance D is constant,
the inputs of the model consist
of :

1) Cycle Time

2)Cars behind red light

3) Cars behind green light

The cars behind the light is the maximum number of cars in the two directions. The corresponding
ouput parameter is the probabilty of change of the current cycle time. Once this
is done, the input and output parameters are divided into overlapping member fuctions,
each function corresponding to different levels. For inputs one and two
the levels and their corresponding ranges are zero(0,1), low(0,7), medium(4,11), high(7,18), and chaos(14,20).
For input 3 , the levels are ver short(0,14), short(0,34), medium(14,60), long(33,88),
very long(65,100), limit(85,100). The levels of output are no(0), probably no(0.25),
maybe(0.5), probably yes (o.75), and yes(1.0). Note: For the output, one value(singleton position) is asosciated
to each level instead of a range of values. The corresponding graphs for each of these
membersip function is drawn in the similar way above.

*Step 2*

The rules, as before are formulated using a series of if-then statements, combined with
AND/OR opearotors. Ex: if cycle time is medium AND Cars Behind Red is low
AND Cars Behind Green is medium, then change is Probably Not. With three inputs, each
having 5,5,and 6 membership functions, there are a combination of 150 rules. However
using the minimum ar maximum criterion some rules are combined to a total
of 86.

*Step 3*

This process, also mentioned above converts the fuzzy set output to real crisp value.
The method used for this system is *center of gravity*:

Crisp Output={Sum(Membership Degree*Singleton Position)}/(Membership degree)
For example, if the output membership degree, after rule evaluation are:

Change Probability Yes=0,
Change Probability Probably Yes=0.6,
Change Probability Maybe=0.9,
Change Probability Probably No= 0.3,
Change Probability No=0.1

then the crisp value will be:
Crisp Output=(0.1*0.00) +(0.3*0.25)+(0.9*0.50)+(0.6*0.75)+(0*1.00)/0.1+0.3+0.9+0.6+0
=0.51

* Is Fuzzy Controller better ?*

* Testing of the controller*

The fuzzy controller has been tested under seven different kinds of traffic
conditions from very heavy traffic to very lean traffic. 35 random chosen car densities
were grouped according to different periods of the day representing those traffic
conditions.

*Performance evaluation*

The performace of the controller was compared with that of a conventional controller
and a human expert. The criteria used for comparison were number of cars allowed to
pass at one time and average waiting time. A performance index which
maximises the traffic flow and reduces the average waiting time was developed.
A means of calculating the average waiting time was also developed,
however, a detailed calculation of this evaluation is beyond the scope of this article.
All three traffic controller types were compared and can be summarized with
the following graph of performance index in all seven traffic categories.

The fuzzy controller passed through 31% more cars, with an average waiting time shorter by 5% than the theoretical minimum of the conventional controller. The performance also measure 72% higher. This was expected. However, in comparison with a human expert the fuzzy controller passed through 14% more cars with 14% shorter waiting time and 36% higher performance index. Result: Machine beats Man!!!!

In conclusion, as Man gets hungry in finding new ways of improving our way of life, new, smarter machines must be created. Fuzzy logic provides a simple and efficient way to meet these demands and the future of it is limitless.

- Fuzzy Thinking

Author: Bart Kosko

- IEEE Journals: Fuzzy traffic Light Controller

Author: Dr. Devinder Kaur, Elisa Konga, Esa Konga, University of Toledo - Fuzzy Logic and Control-Software and hardware Applications

Author: M. Jamishi et al - Preference Relations on a Set of Fuzzy Utilities as a Basis for Descision
Making

Author: K. Nakamura - Fuzzy Set Theory and its Applications

Author: H. J. Zimmerman