Fist, let us start out very simply. The data you have given, to be represented
in a fuzzy format, are:
Speed Fuel Throttle
30 40 28
56 47 60
70 30 80
100 20 100
(I presume that by "Fuel" you mean Fuel Economy.)
To begin with, we represent these as fuzzy sets, with members as shown below:
Speed Fuel Throttle
Slow Good Light
Medium Excellent Moderate
Fast Moderate Heavy
Speeding Poor Full
Next we write some simple rules:
IF Throttle is Light THEN Fuel is Good and Speed is Slow
IF Throttle is Moderate THEN Fuel is Excellent and Speed is Medium
IF Throttle is Heavy THEN Fuel is Moderate and Speed is Fast
IF Throttle is Full THEN Fuel is Poor and Speed is Speeding
We have to define what we mean by the terms Light, Good and so on. Since we
have no information on speeds below 30 or above 100, we have to exclude data
outside of that speed range.
For Throttle, we consider that the term Light is fully applicable (grade of
membership 1.0) if Throttle is 28,
completely inappropriate (grade of membership 0) for Throttle 60 and higher,
and linear in between: thus the value of Light of Throttle is 44 would be 0.5.
For Moderate, 0 at Throttle 28, 1.0 at 60, and 0.0 at 80 and above. For Heavy,
0 for Throttle <= 60, 1.0 at 80, and 0 at 100. For Full, 0 for Throttle <= 80,
an 1.0 at 100. Similarly for Fuel and Speed.
Suppose our throttle setting is 44. Then the grade of membership of Light is
5.0, as is the grade of membership of Moderate. We have now fuzzified the value
of 44 for Throttle.
>From our rules, we conclude that the grades of membership of Slow and Medium
for Speed are both 0.5, and that the grades of membership of Good and Excellent
for Fuel are also both 0.5, using the Zadeh mas-min fuzzy logic. We have now
performed our inferencing.
To obtain numerical values for Speed and Fuel, we have to defuzzify. We pick
the simplest possible method: the weighted average of the maximum values of the
membership functions. This the numerical value for Speed is 0.5 * 30 + 0.5 *
56 = 43, and for Fuel 0.5 * 40 + 0.5 * 47 = 43.5. We have done a simple linear
interpolation. (There are many other ways of defuzzifying, the centroid method
probably being the most popular.)
A caution. The process described here is derived from fuzzy control methods,
and assumes that you are putting numbers in and taking numbers out. This is a
very special case of fuzzy rule-based systems, and while extremely useful is
also extremely limited compared to fuzzy rule-based systems in general. The
notation is very compact, but we pay a price of lack of flexibility for this
advantage. In general, fuzzy rule-based systems may have to answer not only
questions of the "How much?" type, but may also have to answer questions of the
"What is it?" type. The process described above is ill-adapted for that
purpose.
Let us continue with your posting, and now it gets more interesting.
Now you wish to take into account driving conditions (slow, medium, fast) and
type of driving *urban, rural, motorway).
It is somewhat difficult to give a numerical value for driving conditions, but
it can certainly be done by judgement on a rating scale. The problem is that
the rating will probably be subjective. This rating (say zero to one) could be
fuzzified into slow, medium and fast by defining their membership functions.
However, urban, rural and motorway are categorical quantites, and do not lend
themselves well to fuzzification. A better way is to abandon the control
paradigm altogether, and go to a more flexible fuzzy expert system paradigm.
For a more general discussion of fuzzy rule-based systems, visit my Web page at
http://users.aol.com/wsiler/.
We now review the definitions of terms.
A fuzzy set is a collection of objects, to each of which is attached a grade of
membership denoting the degree to which that object is a member of the set. In
fuzzy control, these objects are usually considered to be numbers from the real
line. In fuzzy expert systems, the objects are more likely to be descriptive
words. If the descriptive words describe some numeric quantity, then to each is
attached a membership function which maps a number from the real line onto a
grade of membership for the corresponding descriptive word. While a membership
function is technically a fuzzy set, its special purpose warrants calling it by
its proper name, membership function. If the member words do not describe a
numeric quantity, such as your terms urban, rural and motorway, some other way
has to be found to determine their grades of membership. If these words
describe an intermediate or output quantity, such as a medicial diagnosis,
their grades of membership are usually determined by firing rules. In your
problem, the grades of membership of urban, rural and motorway might be
determined by rules which ask questions of a user. Alternatively, the grades of
membership of urban. rural and motorway might be determined by simply asking
the user to give a confidence (between 0 and 1, say) that each of these terms
is a correct descriptor of the current driving conditions.
Now we come to the purpose of this whole excercise. Do we want to make a
recommendation to the driver? If so, is it numeric or advice in words such as
"Slow down!" That will determine whether our final output is in the form of
numbers or in the form of words.
Unfortunately, the success of fuzzy control systems has led to their paradigm
and even rule syntax being adopted without question by those who deal with more
general-purpose fuzzy expert systems. In my own experience over more than
twelve years working with fuzzy expert systems, the answers desired are far
more often expressed in words rather than in numbers.
William Siler