Dev Dives: Streamline document processing with UiPath Studio Web
Programming definitions on fuzzy logic and genetic algorithms
1. Practical Problems based on the subject MBI 303: Advanced Algorithms
Page 1 of 1
Fuzzy Logic
Sr. No. Definition App.
Marks
1 Consider the set of old people O. The graded membership M of a 5-8
person X to determine whether the person belongs to old class O or
not is defined as follows:
M= 0 if age of X is > 0 years and <= 59 years
M= (age of X -60)/20 if age of X is > 59 years and <= 79 years
M= 1 if age of X is > 79 years
Write a computer program using language of your choice which input
age of a person X in total years and outputs graded membership.
Solution Algorithm:
1. Start.
2. Input the age of a person.
3. Store the age to a variable x.
4. Let the membership we want to calculate is m.
5. If x is between 0 and 59 then m is 0;
6. Else if x is between 60 and 70 then m is ….formula given the
membership function;
7. Else m =1.
8. Print age x as well as membership value m.
9. Stop.
Program
#include<iostream.h>
void main()
{
int x;
float m;
cout << " Input the age of the person: ";
cin >>x;
if (x > 0 && x<= 59)
{
m=0;
}
2. Practical Problems based on the subject MBI 303: Advanced Algorithms
Page 2 of 2
else if( x > 59 && x <= 79)
{
m = (float)(x-60)/20;
}
else
{
m=1;
}
cout<<" The graded membership function M is : " <<m
<<endl;
}
2 Consider the set of old people O. The graded membership M of a 5-8
person X to determine whether the person belongs to old class O or
not is defined as follows:
M= 0 if age of X is > 0 years and <= 59 years
M= (age of X -60)/20 if age of X is > 59 years and <= 79 years
M= 1 if age of X is > 79 years
Write a computer program using language of your choice which input
the graded membership to a person X and outputs broad category of
the age of the person X.
3 Consider the set of old people O. The graded membership M of a
person X to determine whether the person belongs to old class O or
not is defined as follows:
M= 0 if age of X is > 0 years and <= 59 years
M= (age of X -60)/20 if age of X is > 59 years and <= 79 years
M= 1 if age of X is > 79 years
Write a computer program using language of your choice that returns
complement membership of the above set. The input to the program is
age of a person x and output is the complement of the graded
membership to a person X between the closed interval [0,1].
4 Consider the set of machines, M, and the set of people, P, defined as 8-10
follows:
M = { set of all machines in a domain}
e.g., M = { m1, m2, m3…, mn} where n =3
3. Practical Problems based on the subject MBI 303: Advanced Algorithms
Page 3 of 3
P = {set of people}
e.g., P = { p1, p2, p3, …, pk} where k =3
The fuzzy relationship “generally comfortable” can be defined as:
m1 m2 m3
p1 1.0 0.4 0.7
p2 0.8 1.0 0.6
p3 0.7 0.6 1.0
Write a program which takes machine identification M and person
identification P and returns the degree of comfort of the given P on
the given machine M.
Also list the ideal machine for each person where the person is most
comfortable.
5 Consider U = V = {1,2,3}. The relationship R of U*V, defined as 8-10
“approximately equal,” is a binary fuzzy relationship given by 1/(1,1),
1/(2,2), 1/(3,3), 0.8/(1,2), 0.8/(2,3), 0.8/(2,1), 0.4/(1,3), 0.8/(3,2) and
0.4/(3,1).
Consider another relationship, S, of U*V in which x is considerably
larger than y for ∀x∈U and ∀y∈V. The relationship S can be given as
X/Y 1 2 3
1 0 0.6 0.8
2 0.6 0 0.6
3 0.8 0.6 0
Find and print
(i) μR∩S(x,y) and
(ii) μR∪S(x,y)
6 Develop a computer program which prints a menu on clears screen as 20
follows:
4. Practical Problems based on the subject MBI 303: Advanced Algorithms
Page 4 of 4
Lab Experiments on Fuzzy Logic
------------------------------------------
Program 1 Section 2 Fuzzy Logic
Program 2 Section 2 Fuzzy Logic
Program 3 Section 2 Fuzzy Logic
Program 4 Section 2 Fuzzy Logic
Program 5 Section 2 Fuzzy Logic
Exit
------------------------------------------
Implement all the programs using functions or routines (in a single or
different programs, as per your convenience). The program while
execution should ask the users for his/her choice and perform function
accordingly.
If user gives invalid choice the program should print appropriate
message.
The program should be terminated only if the choice # 6 (Exit) is
given by the user.
5. Practical Problems based on the subject MBI 303: Advanced Algorithms
Page 5 of 5
Genetic Algorithms
Sr. Definition App.
No. Marks
1. Write a program for single variable function optimization. Read valid 5-8
initial population (n individuals) through keyboard for Maximization
of f (x).
Where f (x, y) = x4
2 Write a program for single variable function optimization. Read valid 5-8
initial population (n individuals) through keyboard for Minimization
of f (x).
Where f (x, y) = x + x2
3 Write a program for double variable function optimization. Read valid 5-8
initial population of 10-bits (four individuals) through keyboard and
scale the interval [0, 1) for Maximization of f (x, y).
Where f (x, y) = yx2 – x4
4 Write a program for double variable function optimization. Read valid 5-8
initial population of 10-bits (four individuals) through keyboard and
scale the interval [0, 1) for Minimization of f (x, y).
Where f (x, y) = yx2
5 Simulation of operators 15-20
Mutation
Cross-over
Recombination operators
Menu driven system
6 Traveling salesman problem 10-15