**1**

## My Study on Fuzzy Logic

fuzzy logic ai artificial intelligence

So, someone recently (perhaps accidentally) introduced me to the term "fuzzy logic," and this is what I have been looking for! I am having a sort of hard time wrapping my head around how it works exactly, because I have only been using Boolean logic. However, since I am new to programming, I am not set in my ways, so I can retrain myself easier.

And I am very glad that I was introduced to this sooner than later. Right now I have been trying to implement fuzzy logic, but I quickly found myself reverting back to Boolean logic, or using some sort of probability. I just found the perfect documentation of fuzzy logic, and I am going to read this first. I will update my findings here, for anyone who might be interested.

http://www.fuzzysys.com/books/FLLib/FUZZYPDF/FUZZYLOG.PDF

(value-min)/(max-min)

on a scale of 10 to 100 where 10 is cold and 100 is hot:

55 degrees is given as degree .5 in the set.

That means it is halfway between the minimum temperature and the maximum temperature.

If the word "warm was given the range of 60 to 100 degrees, then the membeship of warm is given as:

(60-10)/(100-10)

or

.55<x<1

This means that all values greater than .55 and less than 1 are considered warm.

In reality, I would use temperatures 75-85.

I finally have an implementation that can fuzzify a range of values from a minimum number to a maximum number as a string. For this example I used the Codea app on the iPad.

It also prints the value of the membership of the chosen value (not quite as a fuzzy member... yet.)

Okay, I am coming up with so many examples of how fuzzy logic can be used:

These prices are ridiculous!:Today I was looking at the prices on a menu and I said to myself "These prices are getting ridiculous!"

What I was really saying is that "The prices are getting closer to my idea of a high price."

For a rich person, they might not be so ridiculous, but to me (a poor person), they are indeed ridiculous.

If I considred my idea of a ridiculous price for a burger to be 7 dollars, then is a burger that is 6.99 not ridiculous?

Instead, I would consider my idea of ridiculous to be in the range (5,8), with the epitamy of ridiculous being at 7. All else above 8 is still ridiculous, and not even worth mentioning. Or it might fall into another set "insanely ridiculous."

All numbers lower than the min might be classified a something else, same for all numbers above.

The couch is too close to the wall!What this means is that the distance from the couch to the wall is less than a distance you presume to be "a good distance from the couch to the wall."

You are driving too fast!:A range of values greater than 7 above the speed limit might be considered fast on a normal road, but on the highway, it depends on the flow of traffic, where even 10 above the speed limit would be considered a little slow.

That gun is dangerous!:This means that the gun has the potential to decrease your health severely. If perfect health is 100% healthy, then perhaps a gun could do -85% to -100% damage to your health, whereas something that is not as dangerous would do perhaps -10%--20% to your health.

You cut the apple crookedly:This means that the angle at which you cut the apple is not perpendicular to the surface you are cutting the apple on. But such a cut is impossible anyhow, so it really means that the angle at which you cut the apple is not "close to perpendicular" to the surface you are cutting the apple on. This angle could range from an offset of 90 plus or minus 5 degrees. (85,95).

I have found my first good use for fuzzy logic after looking at a few videos on Problem solving. A really good use for fuzzy logic is in

Value Analysis. The following link is a very good video on value analysis, however, it's demonstration on how value is found is not a solid method. He uses words like "good" and "bad" and gives each word a value range, but he doesn't account for the degrees of "goodness" or "badness" which would present more accurate information. Anyhow, this is the video:Hmm, looks like this form of logic is going to come in handy sooner than I thought. I am trying to do weather, and someone was using finite state machine and probability percentage to try to do it. In this case, fuzzy logic would be much better suited.

http://www.gamedev.net/topic/59358-simulating-weather/

So, I might have not had to discover the "fuzzy formula" on my own if I knew the keywords were Data Normalization and Standardization:

http://www.benetzkorn.com/2011/11/data-normalization-and-standardization/

Note: GameDev.net moderates comments.