Decision Support System and Expert SystemUnit 910 min read
Fuzzy Logic & Expert Systems: Rules, Reasoning & Real-World Apps
Unit 9 of Decision Support System and Expert System explores fuzzy logic principles, fuzzy reasoning processes, expert system architectures, and real-world applications in Nepalese contexts (e.g., traffic management, loan approvals). Covers fuzzy rules, membership functions, inference systems, and case studies like NTC
TAKEAWAYS:
- Fuzzy logic handles uncertainty by using membership functions (0–1 degrees) instead of binary true/false, enabling systems to reason with imprecise data.
- A fuzzy expert system combines fuzzy logic with rule-based reasoning to make decisions in ambiguous domains (e.g., medical diagnosis, traffic control).
- The fuzzy inference system (Mamdani/Sugeno) maps inputs to outputs via fuzzification, rule evaluation, and defuzzification—visualized as a pipeline.
- Nepalese applications include NTC’s network congestion prediction (fuzzy rules for traffic routing) and bank loan approvals (fuzzy credit scoring).
- Errors in fuzzy systems arise from poor rule design, incorrect membership functions, or defuzzification mismatches—always trace the pipeline to debug.
- Compare crisp vs. fuzzy logic using truth tables and membership graphs to highlight why fuzzy systems excel in real-world ambiguity.
1. Why Fuzzy Logic? Crisp Logic’s Limitations
Crisp (Boolean) logic forces decisions into 0 (false) or 1 (true). But real-world data is often gradual or ambiguous:
- Example: A bank loan officer rates a customer’s creditworthiness as "good," "average," or "poor"—not just "yes/no."
- Problem: Crisp logic cannot model "partially true" statements like "The traffic is somewhat heavy."
graph LR
A["Crisp Logic"] -->|"Input"| B["Temperature = 30°C"]
B -->|"Rule"| C["IF Temp > 25°C THEN 'Hot' = 1"]
C -->|"Output"| D["Hot = 1 (True)"]
E["Fuzzy Logic"] -->|"Input"| F["Temperature = 30°C"]
F -->|"Membership"| G["Hotness = 0.8 (80% true)"]
G -->|"Output"| H["Hot = 0.8"]Visual: Compare crisp (binary) vs. fuzzy (gradual) membership for "hot" temperature.
2. Core Concepts: Fuzzy Sets and Membership Functions
2.1 Fuzzy Sets
- A fuzzy set defines degrees of membership (e.g., "tall" = 0.7 for height 170 cm).
- Crisp set: {170 cm} ∈ "tall" only if height ≥ 180 cm.
- Fuzzy set: μ("tall"|170 cm) = 0.7 (70% membership).
2.2 Membership Functions
Shapes used to model gradual transitions:
- Triangular: Simple, linear rise/fall (used in traffic speed classification).
- Trapezoidal: Flat top for "fully true" ranges (e.g., "very high" speed).
- Gaussian: Smooth bell curve (e.g., medical symptom severity).
graph TD
A["Input: Speed = 70 km/h"] --> B["Triangular: Low(0-40), Medium(30-80), High(60-100)"]
B --> C["μ(Low) = 0.0, μ(Medium) = 0.7, μ(High) = 0.3"]
C --> D["Fuzzy Output: 'Medium' dominance"]Worked Example (Nepal Traffic):
- Rule: "IF speed > 60 km/h THEN risk = high."
- Membership for 70 km/h:
- Low: 0.0 (outside 0–40 km/h)
- Medium: (80–70)/(80–30) = 0.7
- High: (70–60)/(100–60) = 0.3
- Output: Risk = max(0.7, 0.3) = 0.7 ("high").
3. Fuzzy Rules and Inference Systems
3.1 Fuzzy Rules
Format:
IF <antecedent> THEN <consequent> [weight]
- Example (Loan Approval):
IF (income = high) AND (credit_score = good) THEN approve_loan = 0.9IF (income = low) OR (debt = high) THEN approve_loan = 0.1
3.2 Fuzzy Inference Process
- Fuzzification: Convert crisp inputs to membership degrees.
- Rule Evaluation: Apply min/max operators to rules (e.g., AND = min, OR = max).
- Aggregation: Combine rule outputs (e.g., max for Mamdani).
- Defuzzification: Convert fuzzy output to crisp value (e.g., centroid method).
flowchart LR
A["Crisp Inputs"] --> B["Fuzzification\n(Triangular MF)"]
B --> C["Rule Base\nIF-THEN"] --> D["Inference Engine\nMin/Max"]
D --> E["Aggregation\nMax"] --> F["Defuzzification\nCentroid"]
F --> G["Crisp Output"]Worked Example (Bank Loan):
- Inputs:
- Income = 50,000 NPR (μ(high) = 0.6, μ(low) = 0.4)
- Credit score = 700 (μ(good) = 0.8, μ(poor) = 0.2)
- Rules:
- IF income = high AND credit = good THEN approve = 0.9
- IF income = low OR credit = poor THEN approve = 0.1
- Evaluation:
- Rule 1: min(0.6, 0.8) = 0.6
- Rule 2: max(0.4, 0.2) = 0.4
- Aggregation: max(0.6, 0.4) = 0.6
- Defuzzification: Centroid of "approve" membership → Approval score = 0.6 (60% likely).
4. Types of Fuzzy Expert Systems
| Type | Description | Example (Nepal) | Advantages |
|---|---|---|---|
| Mamdani-Type | Uses linguistic rules (IF-THEN) with fuzzy outputs. | NTC’s traffic light optimization. | Easy to design, interpretable. |
| Sugeno-Type | Outputs are linear functions (e.g., y = a*x + b). |
Daraz’s dynamic pricing algorithm. | Faster computation, works with math models. |
| TSK (Takagi-Sugeno-Kang) | Combines Mamdani’s rules with Sugeno’s functions. | Ncell’s network congestion prediction. | Balances interpretability and precision. |
| Adaptive Fuzzy Systems | Membership functions adjust via learning (e.g., neural networks). | Khalti’s fraud detection. | Self-improving, handles new data. |
5. Real-World Applications in Nepal
5.1 NTC’s Traffic Management System
- Problem: Kathmandu traffic is unpredictable (accidents, protests, weather).
- Solution: Fuzzy rules classify traffic density in real-time:
IF (vehicle_count > 50 AND speed < 20 km/h) THEN risk = "critical" (0.9)
- Output: Dynamically adjusts signal timings to reduce congestion.
- Visual:
graph TD A["Sensor Inputs"] --> B["Fuzzify: Low/Medium/High"] B --> C["Rules: IF density=high THEN extend green"] C --> D["Defuzzify: New signal timing"]
5.2 Bank Loan Approval (Nabil Bank)
- Crisp System: Rejects if credit score < 650 (binary).
- Fuzzy System: Approves with partial weight:
IF (score = 600) AND (income = medium) THEN approve = 0.4- Result: Customer gets a smaller loan or better terms.
5.3 Daraz’s Dynamic Pricing
- Problem: Seller prices fluctuate; buyers expect fair deals.
- Fuzzy Logic: Adjusts prices based on:
IF (demand = high) AND (inventory = low) THEN price = base + 20%IF (competitor_price = low) THEN price = competitor_price + 5%
- Outcome: Prices adapt smoothly without hard thresholds.
6. Errors in Fuzzy Expert Systems
| Source of Error | Cause | Example | Fix |
|---|---|---|---|
| Poor Rule Design | Rules are too vague or conflicting. | "IF speed = fast THEN brake" (no quantifier). | Use precise membership functions. |
| Incorrect Membership Functions | MFs don’t match real-world data. | Triangular "hot" starts at 20°C (too low). | Retrain MFs with actual temperature data. |
| Defuzzification Mismatch | Centroid method ignores rule weights. | Sugeno output ignored in Mamdani system. | Use weighted average defuzzification. |
| Data Noise | Sensors provide unreliable inputs (e.g., traffic cameras fail). | Speed sensor reads 0 km/h during rain. | Add noise filters or redundant sensors. |
Debugging Trace (NTC Traffic System):
- Symptom: Traffic lights turn green too often, causing jams.
- Check Rules:
- Rule:
IF (density = low) THEN green_time = 30s - Error: "Low" density MF includes 20–40 vehicles (too broad).
- Rule:
- Fix: Narrow MF to 0–20 vehicles for "low."
7. Fuzzy Logic vs. Crisp Logic: Comparison
| Feature | Crisp Logic | Fuzzy Logic |
|---|---|---|
| Truth Values | 0 or 1 (binary) | 0 to 1 (continuous) |
| Rule Complexity | Simple (IF A THEN B) | Handles "AND," "OR," and weights (e.g., IF A=0.7 AND B=0.5 THEN C=0.4) |
| Real-World Fit | Poor for gradual changes (e.g., "tall") | Excels in ambiguity (e.g., "somewhat hot") |
| Computational Cost | Low | Higher (fuzzification/defuzzification steps) |
| Example Use Case | Digital circuits (ON/OFF) | Traffic control, medical diagnosis |
Visual:
pie
title Crisp vs. Fuzzy Logic Use Cases
"Crisp (Digital)" : 30
"Fuzzy (Analog/Ambiguous)" : 708. Exam Tip: How to Score Full Marks
- Define Clearly:
- Start every answer with definitions (e.g., "Fuzzy logic is a mathematical framework that allows partial truth values between 0 and 1, enabling systems to handle uncertainty.").
- Draw Diagrams:
- For fuzzy inference, always sketch the pipeline (fuzzification → rules → defuzzification).
- For membership functions, plot a triangular/trapezoidal graph with labeled axes.
- Use Nepalese Examples:
- Link fuzzy logic to NTC traffic, bank loans, or Daraz pricing. Examiners love context!
- Compare Tables:
- For "types of fuzzy systems," use a 2-column table (Mamdani vs. Sugeno) with pros/cons.
- Show Worked Steps:
- For fuzzy reasoning, write every step (e.g., min/max calculations, defuzzification formula).
- Avoid Vague Language:
- ❌ "Fuzzy logic is useful." ✅ "Fuzzy logic improves NTC’s traffic management by gradually adjusting signal timings based on membership degrees of vehicle density, reducing congestion by 15% in simulations."
Pro Tip: Memorize the 4-step fuzzy inference process and the 3 common membership functions (triangular, trapezoidal, Gaussian). Exams often ask to "explain fuzzy reasoning"—this is your formula for 10/10.
Based on the TU BSc CSIT syllabus for Decision Support System and Expert System (CSC469), unit 9.
Discussion
Loading…