Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Programming definitions on fuzzy logic and genetic algorithms

555

Published on

These are some sample lab e

These are some sample lab e

1 Comment
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• These are some laboratory exercises on fuzzy logic and genetic algorithms. Please visit pritisajja.info for further detail or see other uploads by Dr Priti Srinivas Sajja.

Are you sure you want to  Yes  No
• Be the first to like this

Views
Total Views
555
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
10
1
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Practical Problems based on the subject MBI 303: Advanced Algorithms Page 1 of 1Fuzzy LogicSr. No. Definition App. Marks1 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 &gt; 0 years and &lt;= 59 years M= (age of X -60)/20 if age of X is &gt; 59 years and &lt;= 79 years M= 1 if age of X is &gt; 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 &#x2026;.formula given the membership function; 7. Else m =1. 8. Print age x as well as membership value m. 9. Stop. Program #include&lt;iostream.h&gt; void main() { int x; float m; cout &lt;&lt; " Input the age of the person: "; cin &gt;&gt;x; if (x &gt; 0 &amp;&amp; x&lt;= 59) { m=0; }
• 2. Practical Problems based on the subject MBI 303: Advanced Algorithms Page 2 of 2 else if( x &gt; 59 &amp;&amp; x &lt;= 79) { m = (float)(x-60)/20; } else { m=1; } cout&lt;&lt;" The graded membership function M is : " &lt;&lt;m &lt;&lt;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 &gt; 0 years and &lt;= 59 years M= (age of X -60)/20 if age of X is &gt; 59 years and &lt;= 79 years M= 1 if age of X is &gt; 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 &gt; 0 years and &lt;= 59 years M= (age of X -60)/20 if age of X is &gt; 59 years and &lt;= 79 years M= 1 if age of X is &gt; 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&#x2026;, 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, &#x2026;, pk} where k =3 The fuzzy relationship &#x201C;generally comfortable&#x201D; 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 &#x201C;approximately equal,&#x201D; 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 &#x2200;x&#x2208;U and &#x2200;y&#x2208;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) &#x3BC;R&#x2229;S(x,y) and (ii) &#x3BC;R&#x222A;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 5Genetic AlgorithmsSr. Definition App.No. Marks1. 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) = x42 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 + x23 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 &#x2013; x44 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) = yx25 Simulation of operators 15-20 Mutation Cross-over Recombination operators Menu driven system6 Traveling salesman problem 10-15