Artificial Intelligence
Fuzzy Logic; Genetic Algorithms
C-CAT
Fuzzy Logic
What is Fuzzy Logic?
"Fuzzy" = vague, not clear, imprecise — real-world characteristics.
Classical (crisp) logic: operates with binary values — True (1) or False (0).
Real life problem: Statements are often neither completely true nor false:
- "This person is tall" — how tall is tall?
- "It is quite hot today" — how hot?
- "The car is moving fast" — how fast?
Fuzzy Logic: allows truth values to be any value between 0 and 1, representing degrees of truth.
Fuzzy vs Classical Logic
| Feature | Classical Logic | Fuzzy Logic |
|---|---|---|
| Values | 0 or 1 (binary) | [0.0 to 1.0] (continuous) |
| "Age 25 is young" | True or False | True to degree 0.8 |
| Uncertainty | Cannot handle | Handles naturally |
| Mimics human reasoning | No | Yes |
Fuzzy Membership Functions
Membership
Degree
1.0 | /\ /\
| / \ / \
0.5 | / \ / \
|/ \ / \
0.0 +--------\--/--------\-----> Temperature
COLD WARM HOT
Each value belongs to multiple fuzzy sets with different degrees.
Fuzzy Logic System
Crisp Input --> Fuzzification --> Fuzzy Inference --> Defuzzification --> Crisp Output
(e.g., temperature = 35 C) (Apply rules) (Convert back) (e.g., fan speed = 70%)
Use Cases of Fuzzy Logic in AI
- Engineering decisions with uncertainty / imprecise data (e.g., NLP — "large file", "recent")
- Regulating and controlling machine outputs with multiple inputs (e.g., temperature control systems)
Additional Applications:
- Air conditioner temperature control
- Washing machine cycle selection (water/dirt level fuzzy)
- Anti-lock Braking System (ABS)
- Camera auto-focus
Medical diagnosis systems
Fuzzy Logic vs Neural Networks
| Aspect | Fuzzy Logic | Neural Network |
|---|---|---|
| Knowledge source | Expert-defined rules | Learned from data |
| Interpretability | High (transparent rules) | Low (black box) |
| Training required | No | Yes |
| Computing resources | Low | High |
| Best for | Control systems, embedded | Pattern recognition, large data |
Genetic Algorithms
What are Genetic Algorithms?
Genetic Algorithms (GAs) are search and optimization techniques inspired by natural evolution — specifically Darwin's theory of natural selection.
They are part of Evolutionary Computing — a branch of AI. GAs are effective for:
Complex optimization problems
- Problems where the search space is large
- Problems where traditional methods are too slow
Biological Analogy
| Biology | Genetic Algorithm |
|---|---|
| Individual (organism) | Candidate solution |
| Chromosome | Encoded solution (bit string) |
| Gene | One parameter of the solution |
| Population | Set of candidate solutions |
| Fitness | Quality/goodness of solution |
| Natural Selection | Select better solutions |
| Crossover | Combine two solutions |
| Mutation | Random small change |
| Generation | One iteration of the algorithm |
Genetic Algorithm Workflow
Step 1: INITIALIZATION
Create a random initial population of solutions
Population: [10110010, 01101100, 11001011, 00111010, ...]
Step 2: EVALUATION
Calculate fitness of each individual (how good is this solution?)
Fitness: [0.82, 0.45, 0.91, 0.33, ...]
Step 3: SELECTION
Select better-fit individuals for reproduction
(Methods: Tournament,
Roulette Wheel, Rank-based)
Step 4: CROSSOVER (Recombination)
Combine two parents to create offspring
Parent 1: 1 1
0 1 | 0 0 1 0
Parent 2: 0 1 1 0 | 1 1 0 1
Child: 1 1 0 1 | 1 1 0 1 (crossover at
position 4)
Step 5: MUTATION
Randomly flip some bits (small probability)
Before: 1 1 0 1 1 1 0 1
After: 1 1 0 1 0 1 0 1 (bit 5 flipped)
Step 6: REPLACEMENT
Replace old population with the new generation
Step 7: TERMINATION
If best solution found OR max generations reached -> STOP
Else -> Go to Step 2
Applications of Genetic Algorithms
| Application | Description |
|---|---|
| Feature Selection | Select the best features for ML models |
| Neural Architecture Search | Find optimal neural network architecture |
| Route Optimization | Traveling Salesman Problem (shortest route) |
| Game Playing | Evolve AI game strategies |
| Engineering Design | Optimize structural designs (aerodynamics) |
| Financial Trading | Evolve trading strategies |
| Scheduling | Job shop, airline crew scheduling |
| Drug Design | Optimize molecular structures |
Continue learning
Related notes
Definition of AI; Need of AI
Artificial Intelligence
Introduction to Data Engineering; Big Data — The 5 V's; Types of Data
Big Data and Data Engineering
Introduction to C Programming; C Program Structure; Data Types and Variables
C Programming
What Is a Computer?; Machine Cycle: Fetch–Decode–Execute; CPU Organization
Computer Architecture
Put this topic into timed practice
Open mock tests when you want full-exam pacing, or keep drilling in practice mode.