## What Is Fuzzy Logic?

The word fuzzy means things that are not very clear or vague. In real life, everyone comes across a situation where they can’t decide if a statement is true or false. Whenever such a scenario arrives, fuzzy logic provides valuable flexibility for reasoning by considering the uncertainties of the situation.

Fuzzy logic helps in solving a particular problem after considering all the available data and then taking the suitable decision. The fuzzy logic method emulates the human way of decision making, which considers all the possibilities between digital values of True and False.

## History of Fuzzy Logic

At first, the concept of Fuzzy Logic (FL) was introduced by Lotfi Zadeh. He was a professor at the University of California at Berkeley, and it was not presented as a control methodology, but as a way of data processing. According to his observation, unlike other computers, Fuzzy Logic consists of a range of possibilities between T or F, in human decisions.

Due to insufficient small-computer capability prior to that time, this approach was not applied until the ‘70s. Professor Zadeh concluded that people don’t require exact numerical information and yet are able to have high adaptive control. Feedback controllers which are mathematical systems to analyze input values in terms of logical variables can be much more effective and easier to implement if they can be programmed to accept noise and imprecise input.

## Implementation of Fuzzy Logic System

Fuzzy logic can be implemented in systems with different sizes and capabilities. For implementation, there should be a range of micro to macro controllers. Moreover, it can also be implemented in hardware or software or in a combination of both in Artificial Intelligence

## Why Fuzzy Logic?

Generally, fuzzy logic systems can be used for practical and commercial purposes. Also, it can be used in –

• Consumer products and control machines
• Dealing with uncertainty in engineering
• Giving at least acceptable reasoning if not accurate reasoning.

Apart from this, fuzzy logic offers various unique features that make it a perfect choice for controlling many problems:

1) It is intrinsically robust since it does not require fixed, noise-free inputs and can be programmed to fail safely if a feedback sensor quits or is destroyed. Despite a wide range of input variations, output control is the smooth control function.

2) Fuzzy logic controller process user-defined rules and override the target control system. It can be altered easily to improve or boost system performance. By generating appropriate governing rules, new sensors can be easily generated into the system.

3) Fuzzy logic is not limited to only one or two control outputs or few feedback inputs. Also, it’s not necessary to measure change rate parameters before its implementation. Data from sensors that provide some system indication is enough. This will allow the sensors to be inexpensive and keeping the system cost low for the overall setup.

4) Due to the rule-based operation, inputs of reasonable numbers like (1-6 or more) and numerous outputs like (1-4) can be generated. Although, defining the rules may become complex in case too many inputs and outputs are chosen for single implementation, since after defining rules, their interrelations must be defined. Also, it will be a good idea to break the control system in smaller portions and use multiple fuzzy logic controllers distributed on the system, with each one carrying more responsibilities.

5) Fuzzy logic is capable of managing non-linear systems that would be difficult to manage mathematically. This will open the doors for the control system and it would be easy to gauge feasibility for automation.

## Fuzzy Logic Sets

A set can be defined as the collection of objects that share certain characteristics. In Fuzzy logic there are two types of set-

1. Classical Set
2. Fuzzy Set

#### Characteristic Function

``````Set C can be specified = Char C(x)

If U is the universal set, then -
C = { x | x Î U and Char C(x) = 1}

For an ordinary set C-
Char C(x): U à {0,1}

However,for Fuzzy set A -
Char F(x): U à [0,1]

``````

#### Classical set

1. It is a collection of distinct objects. Let say, a set of students passing grades.
2. Each individual entity is called a member or an element of the set.
3. Spitted into two groups members and non-members.
4. In classical sets, no partial membership exists.

#### Operation on Classical Sets

``````Union A ∪ B = {x | x ∈ A or x ∈ B}

A ∪ B= Union between the two sets (It represents all those elements belonging to the set in the universe). A set, B set or both A and B. This operation is known as logical.

A ∩ B= Intersection of the two sets (It represents all those elements that belong to both sets). This operation is known as logical.
``````

#### Fuzzy set:

1. A set having degrees of membership between 1 and 0.
2. These are represented with tilde character (~).
3. Partial membership exists
4. In the same universe, members of one fuzzy set can also be a part of another fuzzy set.

#### Examples of Fuzzy Set Operations

1. Chemical engineering case

Let’s assume that the selection of an appropriate analyzer to monitor the ‘‘sales gas’’ sour gas concentration is important. The process of selection can be complex by the fact that one analyzer, say A, does not provides suitable pressure range but it is providing borderline value. In comparison to another analyzer, say B,that is giving good value of process dead time but not a suitable pressure range.

For this problem there are three analyzers: A, B and C. (Assumption)

1. Which analyzer is suitable for pressure range suitability? (Remember 0 is not suitable, a value of 1 is excellent) ?

2. Which analyzer is suitable for instrument dead time? (Remember, 0 is not suitable and 1 is excellent) ?

3. Which analyzers are not suitable for pressure range and instrument dead time?

4. Which analyzer is most suitable in the individual category ?

5. Which analyzer is best in both situations?

## How is Fuzzy Logic used?

1. Define Criteria And Control Objective: The user needs  clarity about what he is trying to control, the required response, possible system failures, and how the system can be controlled, the required response, possible system failures, and how the system can be controlled.
2. Users need to determine the relationship between input and output and choose the minimum number of variables for input to fuzzy logic and rate of error.
3. By using the rule-based structure of fuzzy logic, first, break the control problem into a series of “IF X AND Y THEN Z” rule that define the desired response for given conditions. The complexity of the rule depends upon the number of input parameters and a number of variables associated with each and every parameter. If it is possible, it’s recommended to use one variable and its time derivative. Although it’s not possible to put any variable without knowing its rate of change and chances of error are high. This will also cripple the system’s ability to minimize overshoot for inputs.
4. Create a fuzzy logic membership function for defining values of input and output terms.
5. Create a necessary routine of fuzzy logic, before and after implementation in software or hardware.
6. System testing, evaluating result tunes the membership functions and rules and then re-test again and again to get the desired results.

Also Read: Decision Tree Algorithm with examples

## Fuzzy Logic Systems Architecture

Basically, there are four parts in the architecture of the fuzzy logic system-

1. Rule Base: It contains all the rules and “if-then” conditions offered by experts to control decision-making. The most recent update in fuzzy logic provides a number of methods for the design and tuning. Moreover, the update has significantly reduced the number of sets of rules.
2. Fuzzification: Fuzzification is the second in this series and it helps to convert inputs. It helps in converting crisp numbers to fuzzy sets. Crisp inputs are measured by sensors and passed into a control system for processing. The module is used to transform inputs of the system and also helps in splitting the input signals into five steps:

– LP: x is a large positive.
– MP: x is a medium positive.
– S: x is small.
– MN: x is medium negative.
– LN: x is large negative.
3. Inference Engine: The third one helps in determining the degree of match between fuzzy inputs and fuzzy rules. Based on that percentage it decides which rule is needed to be implemented. After it, to develop the control actions, applied rules are combined. Generally, the process helps in simulating the human reasoning process and that’s by making fuzzy inference on the inputs and “if-then” rules.
4. Defuzzification: In this module, the transformation of a fuzzy set into crisp value takes place. There are a number of techniques available to do so, and it’s up to the programmer to select the best from the available ones.
5. Linguistic Variables: Linguistic variables are basically the input and output variables of the system. The values of these variables are mostly words and sentences from the natural languages and no numeric value. Linguistic variables can be decomposed into a set of linguistic terms.

#### Example:  Consider an air conditioner

In this, temperature (t) is a linguistic variable representing the temperature of a room. Terms such as hot and cold are used as per real-life examples to qualify the temperature. These both are linguistic temperature values.

Now, T(t) = (too cold, too hot, cold, hot). These can be the outcomes or say a set of decompositions for the linguistic temperature. Each set of this decomposition is called a linguistic term and covers a portion of overall temperature value.

#### Membership Functions

Membership functions are used in the second and fourth parts of the fuzzy logic architecture to map the non-fuzzy values to linguistic terms and vice-versa. Basically, to quantify a linguistic term a membership function is used.

#### Fuzzy logic Controller

The information used by people in their daily life is to make and implement easily. Common thumb rules can be applied to those control conditions according to demand.  To combat the unwanted effect of system feedback, gaining knowledge is the only powerful weapon.

The fuzzy logic controller uses a flexible set of rules. It is then applied with proper membership work specifying values.

## Characteristics of Fuzzy Logic

Have a look at a few important characteristics of fuzzy logic:

• Very flexible and easy to implement
• Helps in mimic of the  logic of human thoughts
• Allows a person to build non-linear function of arbitrary complexity
• Build with complete guidance of experts
• In fuzzy logic, interference is a process of propagating elastic constraints
• Highly suitable method for uncertain reasoning

## When should fuzzy logic not be used?

Fuzzy logic is never a one-size-fits-all solution. So, it’s important to know in which conditions one should not use fuzzy logic.

Have a look at the situations:

• If it’s not easy for a person to map input space to an output space.
• Fuzzy logic can’t be applied in situations  involving common sense.
• If controllers can do the job perfectly without the use of fuzzy logic.

## How is Fuzzy Logic different from conventional control methods?

FL integrates a simple, rule-based “IF X AND Y THEN Z”. The approach is to solve control problems digitally rather than mathematically. The module is empirically-based on the operator experience and not on their technical understanding.

For example-

In spite of dealing with temperature control in terms of SP =500F  T =1000F or 210C TEMP= 220C; terms like IF (process is too cool) AND (process is getting colder) THEN (add heat to the Process or IF (process is too hot) AND (process is heating rapidly) THEN (cool the process quickly) are used.

These terms are inaccurate and yet very descriptive of what must actually happen. Just assume what you will do if the temperature is too cold while taking shower: no doubt, you will make the water normal easily without any trouble. Fuzzy logic is capable of mimicking this type of behavior but at a faster rate.

## How Does Fuzzy Logic Work?

Fuzzy logic needs some numerical parameters in order to determine what is to be considered as significant error and rate of change of that error.  But specific values are usually not needed until very responsive performance is required, where case empirical tuning would determine them.For example, a temperature control system uses a single feedback sensor whose statistics are subtracted from the command sign to compute “error”, after which time-differentiated to yield the rate-of-change-of-error, is called “error-dot”). The error might have units of degs F and small errors taken into consideration [U1] to be 2F while a big blunder as 5F. The error-dot would possibly then have units of degs/min with small mistakes being 5F/min and a large one being 15F/min.

## Fuzzy Logic Applications

These are some applications of fuzzy logic system.

### a. Automotive Systems

• Automatic Gearboxes
• Four-Wheel Steering
• Vehicle environment control

### b. Consumer Electronic Goods

• Hi-Fi Systems
• Photocopiers
• Still and Video Cameras
• Television

### c. Domestic Goods

• Microwave Ovens
• Refrigerators
• Toasters
• Vacuum Cleaners
• Washing Machines

### d. Environment Control

• Air Conditioners/Dryers/Heaters
• Humidifiers

Apart from these applications, fuzzy logic is used in various other sectors, have a look:

In  Industries: The idea of fuzzy control is simply characterized by  a control strategy expressed by a number of fuzzy control rules. Recent applications include water quality control,  automatic train operating systems, elevator control, control of smart locomotives, cement kiln control, power electronics – speed control of DC  motor, induction motor efficiency optimization control.

Products:  Fuzzy logic has been introduced in consumer goods like washing machines and television sets. Recent work has been directed towards developing fuzzy logic-based handheld portable products.

## Fuzzy Vs Probability

Now, we spotlight the distinction between fuzzy logic and possibility considering that a beginner is bound to be confronted with the problem of associating fuzzy with opportunity on the grounds that he has a understanding of the latter and the probability values also lies between 0 and 1.. Suppose we’ve got two facts modems A and B. Both have a value of 0.9 for probability and membership of being ‘error-free’. Membership costs 0.9 means that B is fairly similar to being ‘error-free’. On the other hand, the opportunity that A is error unfastened = 0.9 means  that A is expected to be error unfastened in 90% of the trials. In the opposite 10 instances the modem will deliver unsuccessful results (i.e. 1 in 10 probabilities of being a success), thus the person would choose modem A. Now keep in mind an exclusive scenario. Suppose we trade the numerical values and recollect that both membership as well as values are 0.5. In this case, maximum customers would transfer to modem B due to the fact it gives a 50% possibility of being successful while a club price that low would suggest the unsuitability for such use.

## Advantages of Fuzzy Logic System

• The Fuzzy logic system is very easy and understandable.
• The Fuzzy logic system is capable of providing the most effective solution to complex issues.
• The system can be modified easily to improve or alter the performance.
• The system helps in dealing engineering uncertainties.
• It is widely used for commercial and practical purposes.
• Fuzzy logic systems can be programmed in a situation when feedback sensors stop working.
• Economical sensor can be used which will help to keep overall system cost low.
• Robust setup as no precise inputs required.
• Fuzzy logic can be programmed in a situation where feedback sensor stops working.

## Disadvantages of Fuzzy Logic Systems

• In fuzzy logic setting, exact rules and membership functions are difficult tasks.
• Fuzzy logic is not always correct, so the results are based on assumptions and may not be widely accepted.
• In some cases, fuzzy logic is confused with probability theory and terms.
• Extensive testing with hardware is required for validation and verification of fuzzy knowledge based systems.
• Fuzzy logic doesn’t have the capability of machine learning and neural network type pattern recognition.

## Summary

• The word Fuzzy refers to things that are not clear or vague
• It was first introduced in the year 1965 by the professor of the University of California in Berkeley. His name was Lotfi Zadeh.
• Fuzzy logic system is flexible
• It is easy to implement machine learning techniques.
• Fuzzy logic system is not used if you are using common sense
• The architecture of the fuzzy logic system is divided into 4 parts-
1. Rule Base
2. Fuzzification
3. Interference Engine
4. Defuzzification
• Fuzzy logic has lots of applications like – Copy machine, auto transmission, fitness management, diagnostic system, etc.
• Fuzzy logic helps in controlling machines and consumer products.

You must have got an idea of what fuzzy logic is and must have seen that a fuzzy logic rule is expressed by implication of a fuzzy system in the form of “if..then..” which includes fuzzy variables called linguistic variables. Fuzzy can be defined effectively as the process of human thinking. In this process, ill-defined and linguistic concepts are usually treated. The reason behind this is that fuzzy propositions are qualitative and not quantitative. Fuzzy sets and fuzzy logic are the two impactful tools for handling complexities. They can facilitate the bridge b/w mathematical models and associated physical reality.

In the near future, there is a tremendous scope of fuzzy logic-based products. One of the major areas where its use is needed to be investigated is the mobile communication system. Moreover, it also opens an opportunity for designing ASICs comprising integrated circuits for computational modules. In recent times, fuzzy logic has emerged as a powerful system in dealing with complex problems. Moreover, its role in handling uncertainty of complex engineering problems is also important.  Generally, engineers and scientists face such complex problems which can’t be solved numerically through traditional mathematical methods, but by implementing fuzzy logic to the same, one can characterize and solve the complex problem.

Fuzzy logic has the capability to capture the inaccuracy of linguistic terms in statements. And, it can be concluded that fuzzy logic comes with greater capability to model human common-sense reasoning and decision making.

If you found this tutorial helpful and would like to learn more of such content, upskill with Great Learning’s PGP – Artificial Intelligence and Machine Learning program today!

1