Sign in to follow this  
  • entries
    34
  • comments
    72
  • views
    38978

My Study on Fuzzy Logic

Sign in to follow this  
Tutorial Doctor

1387 views

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
Sign in to follow this  


6 Comments


Recommended Comments

I finally have some progress on getting to implementing this fuzzy logic. I had to find a formula for getting the degree of membership of a single value (non-fuzzy) easily.

(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.

Share this comment


Link to comment

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.

-- Fuzzy logic

--(value-min)/(max-min)

--draw a horizontal line from minimum to maximum, and make the "value" a point on the line, lifted "degree" units up from te line.
--This will look like a triangle

function setup()
   parameter.integer("min",0,100,0)
   parameter.integer("value",0,100,0)
   parameter.integer("max",0,100,0)
   
   parameter.watch("membership")
   parameter.watch("condition")
   
   x=WIDTH/2
   y=HEIGHT/2
   
   x1 = x
   y1 = y
   x2 = x + value
   y2 = x2 
end

  function fuzzify(min,max,condition) 
       if value > min and value < max then
           print(condition)
           return condition
       end
   
   end

function draw()
    
   membership = (value-min)/(max-min) 
   print(membership)
   
   strokeWidth(4)
   stroke(210, 255, 0, 255)
   line(x1,y1,x2,y2)
   
   fuzzify(75,85,"warm")
   fuzzify(85,90,"hot")

   
end

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

Share this comment


Link to comment

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).

Share this comment


Link to comment

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:

 

http://www.youtube.com/watch?v=TT6tVH6cDMM

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now