Fuzzy logic solves the grounding problem. Grounded information labels semantic facts with numerical values. And numerical values can be stored and calculated with computers. In the following blog post, I’d like to give the details what Fuzzy logic is about.
Computers have the same capabilities like a pocket calculator. They have built in mathematical functions like addition and subtraction and they can store the result into a memory cell for further processing. If a computer has no or only a little operating system it can be used always as a calculator and all programming languages in the world are supporting this feature very well.
All the other capabilities of modern computers like database access, internet connection and playing games is realized with the ability to calculate with numbers. If the idea is to realize artificial Intelligence with a computer a mapping from the reality to numerical information has to be found first.
In the literature this problem is called the grounding problem. Grounding is equal to create simplified simulation of the reality which can be processed in a computer. For example, if a video game contains of a variable for the player’s position, then the domain was grounded. Variables and classes are one powerful tool for storing information in a program. The variable “player1” holds the position in the format (x,y).
Classical variable based storage have some bottleneck which prevents that a domain can be grounded. For example, the temperature variable in a washing machine can be stored as “temperature=45”,but this information makes it hard to process the information further.
What most programmers are doing by themself is build categories with the help of case statements. In the c programming language the case statement is written with:
switch(temperature) {
case 1:
case 2:
case 3:
}
Fuzzy logic is an advanced case statement. Instead of jumping to a single statement, the idea is to jump to many statements at the same time. Let me give an example. In a traditional Python script the washing machine has maintain a certain temperature:
if temperature>30 and temperature<=50: increasetemperature()
elif temperature >50 and temperature<=70: donothing()
elfi temperature>70 and temperature<=90: decreasetemerature()
This controller design results into computer like control mechanism. If temperature jumps to 71 the washing machine has to react with an action immediately because a certain boundry was hit.
The idea behind fuzzy logic is to provide a smooth behavior with the help of more advanced variables. A variable like temperature can hold more than a numerical value but it stores semantic information as well. The case statement is no longer needed, because it is stored in the fuzzy variable already. The example situation with the temperature variable would be stored as the following membership variable:
temperature: low(30..50), mid(50..70), high(70..90)
Additionally the boundaries can overlapping so that inbetween values between low and mid temperature are possible. Around this simple idea, many follow up ideas has been invented which includes fuzzy rules and neuro fuzzy systems.
___Criticism___
An often asked question is, if grounding is really needed to create a model. In many cases no formal grounding was introduced but the computer allows to simulate a system perfectly. A typical example are differential equations which doesn’t provide semantic information but are based on mathematical equations. Another argument which speaks against fuzzy logic is, that with normal neural network inbetween values can be stored already. A neural network consists of many input neurons which can have values from 0..1 This allows to store vague information very well.
Fuzzy advocates are claiming that fuzzy logic consists of some unique features not available in differential equations and in neural networks. This feature is the semantic layer. Fuzzy logic has much in common with variable names, but it provides categories for each variable.
___AND operation___
Fuzzy logic is an advanced form of a case statement. The example with temperature categories was mentioned before. Let us increase the complexity a bit to make clear what the advantage of fuzzy logic is. Suppose the washing machine contains of more than a single variable. which are temperature and rotational speed. The idea is to write a controller which reacts to different conditions. A possible attempt to write the controller in normal python code would be:
if if temperature>30 and temperature<=50: tempgrounded=low
elif temperature >50 and temperature<=70: tempgrounded=middle
elfi temperature>70 and temperature<=90: tempgrounded=high
if rotationalspeed>0 and rotationalspeed<=100: rotationgrounded=low
elif rotationalspeed>100 and rotationalspeed<=200:
rotationgrounded=high
if tempgrounded==low and rotationgrounded=low: increasetemperature()
elif tempgrounded==low and rotationgrounded=high: donothing()
The code convertes numerical values into categories and then a decision is made with an AND operation between the categories. This coding style is equal to classical boolean logic. The idaa is that a variable has clear boundary and it is possible to combine values into more complex variables.
The interesting bottleneck is, that the system will respond in the category boundaries not very precise. The problem is known from a line following robot which is working with a bang bang controller. The decision is made very fast and no inbetween values are allowed. The reason is, that after converting a range of temperature values into a string variable many information are lost forever. Fuzzy logic can fix this problem. It is especially useful if the idea is to combine variables with an AND operatror. During that operation no information is lost and the precision is high.