EDITING BOARD
RO
EN
×
▼ BROWSE ISSUES ▼
Issue 43

Fuzzy Logic and its Specific Mechanisms. A Theoretical Introduction.

Mursa Bogdan
Software Developer @ Yardi



PROGRAMMING

“As complexity rises, precise statements lose meaning and meaningful statements lose precision.” - Lotfi A. Zadeh

Designing technical mechanisms that are able to reproduce the functioning of the human body has been one of the most attractive topics, ever since we can remember. If you are wondering why, the answer is a very simple one: people have always attempted to simplify or to improve the activities they need to perform on a day to day basis.   

Starting with the invention of the wheel, which was brought about by people's necessity to carry heavy or extremely heavy loads, or the optical system that was created in order to develop the binoculars that help us see at great distances, these inventions have sped up development in numerous domains.    

Slowly, we started looking for technical solutions for devices that can perform operations like the human brain. This development was triggered by all the past inventions and previous evolution in all the fields. Human intellectual capacity was becoming too costly, or too slow, to be used at such a scale. Therefore, we could state that the appearance of the computer marks the beginning of a new era, where high performance processing becomes possible.  

The way in which a computer interprets the data it receives is a traditional one, meaning the binary logic. In the end, any decision made by this man-made device will be either 0 or 1 or, in a more natural language, true or false. Up until recently, this way of making decisions managed to cover the needs from all the fields that were using computers; however, the rapid growth and development in quality and precision, needed when making decisions, made this traditional logic obsolete. 

Prof. Lotfi A. Zadeh (1965) has been talking for a long time about the need to use a logic that is closer to the human way of reasoning. However, just like Einstein's theories were rejected by his contemporaries (only to become the norm in modern physics some years later), Zadeh's theory, which he called Fuzzy Logic, was rejected by most of the people who saw it. It took many years for the scientific community to actually understand its importance and power. At present, this theory represents one of the basis of modern Artificial Intelligence and it is used in fuzzy systems from: cars, security devices, medical equipment, decision-making mechanisms (marketing, business etc.), photo cameras etc. 

We use the fuzzy logic every day, without even realizing it, because the human mind is made in such a way that this is the type of logic it prefers. To give you an example, if you consider the question "How satisfied are you with the Babes-Bolyai University?", the answers might be "pretty satisfied", "not satisfied", "extremely satisfied", which are all ambiguous, or fuzzy, answers. Because the human mind is built like that, it is easy for us to interpret these answers, using our experience or different objective metrics. But when it comes to a computer that uses binary logic, those answers won't be so easily understandable; these computers only understand values like 0 and 1, "satisfied" or "unsatisfied".   

In fuzzy logic terms, this type of data which can be interpreted by any machine in a binary system is called crisp data. 

To give some practical examples, we will use an interesting situation to analyze how traditional logic and fuzzy logic behave. In this situation, we will try to create, at a conceptual level, a self-driving car system that allows our car to make the best decisions when another car approaches it. 

According to the traditional method, our system will only be able to make 2 decisions: near and far. With the help of Figure 1, we can imagine the distance between the 2 cars as being divided into 2 halves, each half with its corresponding decision. The traditional analysis of the distance between the 2 cars means that we can make only 2 decisions, which can be formulated in an "if-then" structure: if condition then consequence. 

If car B is near, then brake.        

If car B is far, then don't brake. 

If we assume that our car will always be faster than car B and we also take into consideration the rules above, then the system will always brake if car B gets anywhere close to our "Near" area, no matter how close, or far, the cars actually are. Once the distance between the cars is again in the Far interval, our car will re-start and continue until it suddenly brakes again because it reached the "Near" interval. 

The approach that the fuzzy logic brings is that the answer will always be between 0 and 1, including these two. Therefore, the representation of the distance between the two cars will look more like a gradient, as shown in figure 2. 

This way we can obtain sets of rules like the ones above, asking more natural questions:

Is car B close?       

Answer: 0.2 (not very close)     

If car B is as close as 0.2, then brake 0.2 (not so suddenly and strong).         

Answer: 0.8 (pretty close)      

If car B is 0.8 close, then brake 0.8 (pretty suddenly and strong). 

The example above offers a more ambiguous answer to our question, an answer that can be found in the interval [0,1]. A fuzzy number has a fuzzy set as a correspondent and they can be associated (in this case, it's the set "not very close").       

In a real situation, a self-driving car mechanism that would implement the fuzzy logic would be much better at imitating the human behavior, with the car being able to adapt its speed according to the distance between cars without suddenly braking.      

This definitely made you curious about the algorithm that can be implemented in a fuzzy system. This implementation is a very natural one although it has some specific notions (they are suggestive though). 

A fuzzy controller or a fuzzy mechanism is nothing but a car that uses the fuzzy logic. This controller can be a hardware or a software system or both, its purpose being to apply the fuzzy logic in such a way that it interprets the data like a human being would, but much faster.      

The flow of such a mechanism is represented by the following steps:             

  1. Receiving measurement information from another system (in our case that would be a sensor that measures the distance between the 2 cars).

    E.g: 4 m, 5 m etc.              

  2. Let's not forget that our system can only process fuzzy data sets. Therefore, we need to transform the data we receive from crisp data into fuzzy data. These transformations are done according to some metrics established by an expert in applicability. 

    E.g: 4 m represents a value of 0.3 of "Near".    

  3. The resulting set of fuzzy data is used as input in the fuzzy rules of the type if-then, which result in another set of fuzzy data. 

    E.g: If car B is 0.3 m close, then brake 0.3 (not very strong)               

  4. The last step means transforming the fuzzy data into crisp data, so that the systems that read the output from the fuzzy controller can take the right decisions. 

    E.g: 0.3 brake can mean lowering the speed by 30%. 

    However, the architectural details of a system that uses this type of flow makes for another discussion. I hope that the theoretical aspects I presented in this article have been clear and have offered you a detailed picture of the concept behind the fuzzy logic and the systems that implement it.    

I recommend you continue to try and discover, on your own, the practical applications of the systems that use prof. Zadeh's line of thought. The benefits it brings can be incredible and can bring quality and precisions to any project you are developing. 

Conference TSM

VIDEO: ISSUE 109 LAUNCH EVENT

Sponsors

  • Accenture
  • BT Code Crafters
  • Accesa
  • Bosch
  • Betfair
  • MHP
  • BoatyardX
  • .msg systems
  • P3 group
  • Ing Hubs
  • Cognizant Softvision
  • Colors in projects

VIDEO: ISSUE 109 LAUNCH EVENT