SC Unit 2
Basics (video 7-14):
[Link]
&si=s9mUp2J2KLaFr2Ab
All Fuzzy Formula’s From Unit2(ppt based):
Max-Min Composition Simple example :
Follow this Youtube Example :
[Link]
Numericals Playlist:
Follow videos 7-14 numbered.
[Link]
mvF4BSfn3CGMC
Pyqs:
Q2a.
1. Associating Patient Symptoms with Diseases using Fuzzy Relations
Just For Reference.
Note: To make this answer longer to write in exam, we can list down the
membership value of each cell line by line and then show that Matrix.
This is just for more information about how to use the notation properly:
This means A is a set of Symptoms having ordered pairs like (fever is the element
with its membership value in numerator)
Q2b
In traditional (crisp) cyber-security, a firewall might use hard rules: "If the password is
wrong 3 times, block the IP." This is rigid and can block legitimate users who simply
forgot their password.
A Membership Function (MF) allows the system to map crisp, precise inputs (like
the number of failed login,request frequency, or time of access) into a fuzzy "Degree
of Trust" ranging continuously from 0 (Absolute Zero Trust) to 1 (Complete Trust).
Instead of an immediate block, the system can take intermediate actions based on
partial membership in sets like "Safe," "Suspicious," or "Malicious."
Fuzzy membership functions
Let the input variables be:
● number of failed login attempts,
● IP
● request frequency.
For each variable, define fuzzy sets with membership values between 0 and 1. For
example, failed logins can belong to:
● Low,
● Medium,
● High.
Assume,Membership values for failed logins in three sets are as follows:
● Low = 0.8,
● Medium = 0.2,
● High = 0.0.
A high membership in High failed logins increases suspicion, while a high
membership in Low failed logins increases trust.
In above example low=0.8 strongly indicate that login attempts did’nt fail much and
can be considered strongly in Safe category but at the same time it can still
somewhat partially belong to suspicious or unsafe set. This is useful for considering
all possibilities which is not the thing in crisp logic where only safe and unsafe
decision was taken.
Example of trust evaluation
Suppose we define the fuzzy sets:
● Safe connection.
● Suspicious connection.
● Malicious connection.
For a given incoming connection:
● Failed logins = 4,
● IP location = unusual,
● request rate = moderate.
The membership values may be:
● Safe = 0.2,
● Suspicious = 0.7,
● Malicious = 0.5.
This means the system sees the connection as mostly suspicious, with some
malicious tendency.
How it helps in decision making
Instead of rejecting or accepting immediately, the system can:
● allow the connection,
● warn the user,
● block the connection.
For example:
● If Safe > 0.8, allow.
● If Suspicious is highest, challenge with OTP(request more authentication).
● If Malicious > 0.8, block.
So fuzzy membership helps the system make graded decisions based on trust level.
Q2.c)
Ans:
Step 1: Identify the Compound Rules
We are given two rules that control the Fan Speed based on Temperature and
Humidity:
● Rule 1 (R1): IF Temperature is High AND Humidity is Low, THEN Fan speed
is High.
● Rule 2 (R2): IF Temperature is Moderate OR Humidity is High, THEN Fan
speed is Medium.
Step 2: Break Down into Subrules (Premises) In fuzzy logic, compound conditions
are broken down using standard fuzzy set operations:
● The "AND" operator corresponds to the Intersection of fuzzy sets, which is
calculated using the Minimum (min) function.
● The "OR" operator corresponds to the Union of fuzzy sets, which is
calculated using the Maximum (max) function.
Note for every ques like Q2c:
1. Assume membership values for the rules.(Example: temperature is high=0.8)
2. Find firing strength alpha of each rule. Just take min or max among the
assumed membership values of the subrules(antecedents(parts after If)).
3. Clip the output fuzzy set.(i.e Similarly as 1 just do this for Consequents(part
after Then)). Here, the comparison will be done between membership function
of the Consequent and the Alpha of that rule. But here min will be taken
always.
4. Aggregate all clipped outputs.(take max of the output fuzzy sets of all rules)
5. Defuzzify the final result.(just say Finally, convert the combined fuzzy output
into one crisp fan speed using centroid or any suitable method. And give
example like: Suppose the centroid gives:f∗=65,Then the final fan speed
is 65%.)
SC Unit 3
Mamdani FIS
The 6 Steps
Step 1 — Define Fuzzy Rules
Write IF-THEN rules from human expertise.
Example (Tipping Problem):
● Rule 1: IF service is poor OR food is bad → tip is cheap
● Rule 2: IF service is good → tip is average
● Rule 3: IF service is excellent OR food is delicious → tip is generous
Step 2 — Fuzzify the Inputs
Convert crisp inputs into membership values using membership functions.
service = 3, food = 8 → membership of service in "excellent" = 0.0 → membership of
food in "delicious" = 0.7
Step 3 — Apply Fuzzy Operator (Combine Antecedents)
If a rule has AND → take MIN If a rule has OR → take MAX
Rule 3: service(0.0) OR food(0.7) → MAX(0.0, 0.7) = 0.7
Step 4 — Apply Implication (Get Rule Output)
Truncate or scale the output membership function using the rule strength.
Rule strength = 0.7 → clip the "generous" membership function at 0.7
Step 5 — Aggregate All Rule Outputs
Combine all clipped output fuzzy sets into one fuzzy set using MAX operator.
Step 6 — Defuzzify
Convert the combined fuzzy set into a single crisp output — most commonly using
Centroid method (center of gravity).
Sugeno FIS:
Sugeno FIS (Fuzzy Inference System) is a method that uses fuzzy IF–THEN rules
where the output is a mathematical function instead of a fuzzy set.
It produces a final crisp output by taking a weighted average of all rule outputs.
Comparison Between Both FIS:
Q3a:
Ans:
Temperature = 30°C
● Medium = 0.7
● High = 0.3
Humidity = 60%
● Normal = 0.6
● Wet = 0.4
Rules
Rule 1:
👉 IF Temp is High AND Humidity is Wet
→ Fan = High
Rule 2:
👉 IF Temp is Medium AND Humidity is Normal
→ Fan = Medium
What is asked?
👉 Firing strength (α) of each rule
Step: Use AND → min
Final Answer
● Rule 1 firing strength = 0.3
● Rule 2 firing strength = 0.6
Q3b):
Ans:
In healthcare decision systems, symptoms like “mild headache” or “moderate
fatigue” are not exact and cannot be handled well using crisp logic. Fuzzy reasoning
helps by representing these symptoms using membership functions with values
between 0 and 1
For example, headache intensity can belong to fuzzy sets:
● Mild
● Moderate
● Severe
If a patient reports headache level = 4 (on scale 0–10), it may be:
● Mild = 0.6
● Moderate = 0.4
● Severe = 0.0
Similarly, fatigue can be:
● Low = 0.3
● Medium = 0.7
Using fuzzy rules:
● IF headache is Moderate AND fatigue is Medium → condition is Moderate
● IF headache is Severe OR fatigue is High → condition is Severe
Each rule produces a degree (firing strength), and the system combines them to
estimate the overall severity.
🔹 How it improves accuracy
● Handles vague and imprecise symptoms (for example patient could say I
have a mild headache,moderate headache,etc. Such words do not mean
anything for crisp logic which considers only that if the patient has headache
or do not have while fuzzy inference considers such vague word.)
● Considers partial truth instead of yes/no decisions (Instead of saying that
patient is sick =yes or no ,fuzzy implies that patient is 0.7 sick)
● Combines multiple symptoms realistically (Example:Instead of only saying
patient is sick because he has headache fuzzy could combine all symptoms
like fever,cold,etc as well)
● Avoids wrong decisions due to strict thresholds(Crisp logic could say patient
has sever headache if value>5 and not sever if <5. Instead, Fuzzy could say
patient has 0.4 mild headache and so on)
Q3c:
Ans:
Sugeno FIS (Fuzzy Inference System) is a method that uses fuzzy IF–THEN rules
where the output is a mathematical function instead of a fuzzy set.
It produces a final crisp output by taking a weighted average of all rule outputs.
Steps:
1. Take input
2. Convert into fuzzy values
3. Apply rules
4. Compute output for each rule
5. Take weighted average → Final answer
SC Unit 4:
Q4a:
Ans:
Pareto dominance is used in multi-objective optimization to compare solutions
having multiple objectives.
A solution A dominates B if:
1. A is better or equal in all objectives, and
2. A is strictly better in at least one objective
The set of all non-dominated solutions is called the Pareto front.
Numerical Example:
Real World Scenario: Consider a delivery company that wants to:
● Minimize delivery cost (f₁)
● Minimize delivery time (f₂)
Each solution represents a different delivery plan.
Consider two objectives:
● Minimize cost (f₁)
● Minimize time (f₂)
And 5 solutions (Cost,Time) A,B,C,D,E.
🔍 Step-by-step comparison:
● Compare A and E → A is better in both → A dominates E
● Compare B and E → B is better in both → B dominates E
● Compare C and E → C is better in both → C dominates E
👉 So, E is dominated → remove it
🔍 Remaining solutions:
A, B, C, D
● A vs B → A better in time, B better in cost → no dominance
● A vs C → trade-off → no dominance
● B vs C → trade-off → no dominance
● D vs A/B/C → not better in all → no dominance
✅ Final Pareto Front:
👉 {A, B, C, D}
These are non-dominated solutions and represent the best trade-offs.
🧠 Conclusion:
● Pareto dominance helps eliminate inferior solutions
● Pareto front consists of optimal trade-off solutions
● No solution in the Pareto front dominates another
Ans:
Pareto-based evolutionary algorithms use non-dominated sorting to classify
solutions into different levels based on dominance.
Solutions are divided into:
● Front 1 (Rank 1) → non-dominated (best solutions)
● Front 2 (Rank 2) → dominated by front 1
● Front 3 (Rank 3) → dominated further
🌍 Real-world Scenario:
Consider a food delivery service trying to:
● Minimize delivery cost
● Minimize delivery time
Each solution represents a different route plan.
Given Solutions:
🔍 Step 1: Find Front 1 (Non-dominated)
● A → not dominated
● B → not dominated
● C → not dominated
👉 Front 1 = {A, B, C}
🔍 Step 2: Remove Front 1
Remaining:
● D (120,7)
● E (105,6)
🔍 Step 3: Find Front 2
● Compare D and E → E is better in both → E dominates D
👉 Front 2 = {E}
🔍 Step 4: Remaining
👉 D → Front 3
✅ Final Ranking:
🧠 Conclusion:
● Non-dominated sorting organizes solutions into layers
● First front gives Pareto optimal solutions
● Used in algorithms like NSGA and NSGA-II
● Helps in selecting better solutions while maintaining diversity
Ans:
In multi-objective optimization, decision-makers often face conflicting objectives,
such as minimizing cost and minimizing delivery time. In such cases, a single optimal
solution does not exist. Instead, a set of Pareto optimal solutions is obtained,
representing the best trade-offs.
🔹 How decision-makers use Pareto fronts
👉 The Pareto front consists of solutions where:
● No solution is better in all objectives
● Improving one objective worsens another
🧠 Role in decision-making:
1. Provides multiple choices
→ Instead of one solution, decision-makers get several trade-off options
2. Helps understand trade-offs
→ e.g., lower cost may increase delivery time
3. Supports preference-based selection
→ Decision-maker chooses based on business priorities
🌍 Case Study: Supply Chain Optimization
🎯 Problem:
A company wants to:
● Minimize transportation cost (f₁)
● Minimize delivery time (f₂)
🔢 Possible Solutions:
🔍 Analysis:
● A → balanced
● B → moderate cost, faster
● C → fastest but expensive
● D → cheapest but slow
👉 No solution dominates others completely
👉 All are part of the Pareto front
🔹 Decision-making using Pareto front
👉 Decision depends on priority:
● If company wants low cost → choose D
● If wants fast delivery → choose C
● If wants balance → choose A or B
🧠 Key Insight
👉 Pareto front does NOT give one answer
👉 It gives best possible trade-offs
✍️ Conclusion
Pareto fronts help decision-makers by providing a set of optimal trade-off solutions.
In supply chain optimization, they allow businesses to choose solutions based on
priorities such as cost or delivery time, enabling informed and flexible
decision-making.
UNIT4 NOTES :
What is MOGA (Multi-Objective Genetic Algorithm)?
🏷️ 1. Where does MOGA belong? (umbrella)
👉 MOEA (Multi-Objective Evolutionary Algorithms)
→ A posteriori approach (solutions found first, then evaluated)
→ Pareto-based methods
→ MOGA (ranking-based approach)
🔹 2. What is MOGA
MOGA is a Pareto-based evolutionary algorithm that assigns fitness to
solutions based on dominance count. Solutions with fewer dominating
solutions are given higher fitness and are more likely to be selected. Through
repeated selection, crossover, and mutation, the algorithm evolves toward a
set of Pareto optimal solutions.
👉 MOGA is an algorithm that uses:
✔ Pareto dominance
✔ Dominance-based ranking
👉 Instead of selecting one best solution:
● It ranks solutions
● Prefers less dominated ones
🔥 Core Idea
👉 “Better solutions = less dominated solutions”
🔹 3. How ranking works (CORRECT)
👉 For each solution:
● Count how many solutions dominate it
👉 This count is used to assign rank/fitness
🧠 Intuition
👉 Less domination → higher fitness → higher chance of selection
🔹 4. Steps of MOGA (exam-ready)
1. Generate initial population
2. Evaluate objective values
3. Compute domination count for each solution
4. Assign fitness based on domination
5. Select better solutions
6. Apply crossover and mutation
7. Repeat
🧭 MOGA FULL PROCESS (Corrected Example)
🌍 Scenario
A delivery company wants to:
● Minimize cost (f₁)
● Minimize delivery time (f₂)
Each solution = one delivery plan
🔹 Step 2: Evaluate Objectives
✔ Already given:
● f₁ = cost
● f₂ = time
🔹 Step 3: Find Dominance
👉 Compare each:
● A → not dominated
● B → not dominated
● C → not dominated
● D → dominated by A, B, C
🔹 Step 4: Count Domination
🔹 Step 5: Assign Fitness
👉 Lower domination = higher fitness
🔹 Step 6: Selection
👉 Select better solutions:
❌ D → low chance
✔ A, B, C → high chance
🔹 Step 7: Crossover & Mutation
👉 Create new solutions
Example:
● A + B → E (new solution)
● Mutation → slight variation
🔹 New Population
🔹 Step 8: Repeat
👉 Again:
● Evaluate
● Compute domination
● Assign fitness
● Select
🔥 What happens over time?
👉 Population improves:
✔ Bad solutions removed
✔ Good trade-offs survive
👉 Eventually:
✔ Solutions approach Pareto optimal set
✍️ What is NSGA (Non-dominated Sorting Genetic Algorithm)?
🏷️ 1. Where does NSGA belong?
👉 MOEA (Multi-Objective Evolutionary Algorithms)
→ A posteriori approach
→ Pareto-based methods
→ NSGA (Non-dominated Sorting GA)
🔹 2. What is NSGA?
NSGA is a Pareto-based evolutionary algorithm that uses non-dominated
sorting to group solutions into different fronts. Solutions in the best front are
assigned higher fitness and are more likely to be selected. This process helps
in obtaining a well-distributed set of Pareto optimal solutions.
NSGA is a Pareto-based evolutionary algorithm that:
✔ Uses non-dominated sorting
✔ Groups solutions into different fronts
✔ Selects better solutions based on these fronts
🔥 Core Idea
👉 “Better solutions = belong to better (lower-numbered) front”
🔹 3. Steps of NSGA (exam-ready)
1. Generate initial population
2. Evaluate objective values
3. Perform non-dominated sorting
4. Assign rank (Front 1, Front 2, …)
5. Assign fitness based on rank
6. Selection
7. Crossover & mutation
8. Repeat
🧭 NSGA FULL PROCESS (Correct Example)
🌍 Scenario
A delivery company wants to:
● Minimize cost (f₁)
● Minimize delivery time (f₂)
🔹 Step 1: Initial Population
🔹 Step 3: Non-dominated Sorting (IMPORTANT)
🔍 Check dominance properly (one-to-one rule)
✔ A (100,5)
● No solution is better in BOTH cost and time
✔ Not dominated
✔ B (90,7)
● No solution better in both
✔ Not dominated
✔ C (120,4)
● No solution better in both
✔ Not dominated
✔ E (95,6)
● Check all:
o A → worse cost
o B → worse time
o C → worse cost
✔ No one dominates E
👉 So E is ALSO non-dominated
✔ D (130,8)
Compare with A:
● A better in cost AND time
✔ A dominates D
👉 So D is dominated
🔥 Step 4: Form Fronts
✔ Front 1 (Non-dominated):
👉 A, B, C, E
✔ Remove Front 1
👉
Remaining:
D
✔ Front 2:
👉D
🔹 Step 5: Assign Rank
🔹 Step 6: Assign Fitness
👉 Based on front:
● Front 1 → highest fitness
● Front 2 → lower fitness
🔹 Step 7: Selection
👉 Prefer:
✔ A, B, C, E
🔹 Step 8: Crossover & Mutation
👉 Generate new solutions
Example:
● A+B→F
● Mutation → variation
🔹 Step 9: Repeat
👉 Again:
● Sort
● Rank
● Select
🔥 Final Outcome
✔ Population improves
✔ Solutions converge to Pareto front
✔ Better spread of solutions
NSGA-II (Improved NSGA)
🏷️ 1. Where does NSGA-II belong? (umbrella)
👉 MOEA (Multi-Objective Evolutionary Algorithms)
→ A posteriori approach
→ Pareto-based methods
→ NSGA-II (improved version of NSGA)
🔹 2. Why NSGA-II was introduced
👉 Problem with NSGA:
❌ Slow (high computation)
❌ Poor diversity sometimes
❌ No guarantee best solutions are preserved
🔹 3. Key Improvements (VERY IMPORTANT)
⭐ 1. Elitism
👉 Best solutions are always preserved
✔ No loss of good solutions
⭐ 2. Crowding Distance (VERY IMPORTANT)
👉 Measures how spread out solutions are
✔ Helps maintain diversity
🔹 4. What is Crowding Distance (simple)
👉 It tells:
👉 “Is this solution isolated or crowded?”
🧠 Idea:
● Boundary solutions → highest distance
● Middle crowded ones → lower distance
👉 Prefer solutions with higher distance
(what are boundary solutions?
lets say B has cost 90 and C has 120 and A has 100,here B and C are boundary
solutions)
Note:Crowding distance is calculated using a little formula of
next-prev/max-min.
But we can avoid going deeper mathematically.
🔹 5. Steps of NSGA-II
1. Generate initial population
2. Evaluate objectives
3. Perform non-dominated sorting
4. Calculate crowding distance
5. Combine parent + offspring population
6. Sort based on:
o rank (front)
o crowding distance
7. Select best N solutions
8. Apply crossover & mutation
9. Repeat
🧭 NSGA-II FULL PROCESS (Example)
🌍 Scenario
Delivery company:
● Minimize cost
● Minimize time
🔹 Step 2: Non-dominated Sorting
✔ Front 1: A, B, C, E
✔ Front 2: D
🔹 Step 3: Crowding Distance
👉 Suppose:
👉 Meaning:
● A & C → well spread → important
● E → crowded → less important
🔹 Step 4: Selection
👉 Prefer:
1. Lower rank (Front 1)
2. Higher crowding distance
🔹 Step 5: Elitism
👉 Keep best solutions ALWAYS
✔ A, C survive for sure
🔹 Step 6: Crossover & Mutation
👉 Create new solutions
🔹 Step 7: Repeat
👉 Population improves
🔥 Final Outcome
✔ Well-distributed Pareto front
✔ No loss of best solutions
✔ Faster convergence
✍️ VEGA (Vector Evaluated Genetic Algorithm)
🔹 1. VEGA
🏷️ Where it belongs
👉 MOEA
→ A posteriori
→ Non-Pareto based method
🔹 What is VEGA?
👉 First MOEA method
👉 Uses objective-wise selection
🧠 Core idea
👉 Split population into parts
👉 Each part optimized for one objective
🔄 How it works
1. Divide population into groups
2. Each group selected based on one objective
3. Combine groups
4. Apply crossover & mutation
🌍 Simple example
👉 Delivery company:
● Objective 1 → cost
● Objective 2 → time
👉 VEGA:
● Half population selected for cost
● Half for time
● Combine
Step4:
Combine groups
👉 New population:
● B, A (from cost)
● C, A (from time)
Step5: Apply crossover,mutation and then repeat.
⚠️ Problem
👉 Leads to:
❌ biased solutions(Ignores balanced solutions)
❌Middling performance(It creates solutions that are: not best in any objective and
❌ VEGA does NOT ensure:
just average everywhere)
non-dominated solutions
✍️ SOEA (Weighted Sum Method)
Where it belongs
👉 MOEA
→ A priori approach
→ Non-Pareto method
🔹 What is SOEA?
👉 Convert multi-objective → single objective
🧠 Idea
👉
Combine using weights
🌍 Example
● cost = f₁
● time = f₂
👉 f = 0.5·cost + 0.5·time
⚠️ Limitation
👉 Gives:
❌ only ONE solution
❌ depends on weights
❌No Pareto front
✍️Lexicographic Ordering
Lexicographic ordering prioritizes objectives in a fixed order and optimizes
them sequentially. It ignores trade-offs between objectives.
🏷️ Where
👉 A priori approach
🔹 Idea
👉 Give priority to objectives
Example:
1. Minimize cost (first priority)
2. Then minimize time
🧠 Meaning
👉 First optimize main objective
👉 Only then consider others
⚠️ Problem
❌ Ignores trade-offs
❌ Not practical