Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

NATIONAL INSTITUTE OF TECHNOLOGY ROURKELA

Department of Electrical Engineering


Soft Computing Techniques (EE6243/EE637)
Session: 2019 - 2020 (Autumn)
M.Tech. 1st Semester and Dual Degree 7th Semester

Assignment 4: Genetic Algorithm

1. Find the global maxima and the corresponding maximizer of function f1 , f2 , f3 using Genetic Algorithm.

f1 = 150 − (x2 − 20 cos(πx) + 10)


( )
1 2
f2 = 4− x − cos(x) + 1
50
sin2 (x) − 0.5
f3 = 0.5 −
(1 + 0.001x2 )2

Consider the following design criteria:

• x ∈ [−10, 10].
• Accuracy level: upto third decimal point.
• Probability of mutation = 5%.

Guidelines:

1. Decide the string length q.


2. Let a solution string be represented by an 1 × q row vector b in MATLAB, where the last element (b(q))
represents the least significant bit and the first element (b(1)) denotes the most significant bit of the
binary number. Write a MATLAb function x = binary2decimal(b, xl , xu , q) that decodes the binary string
and returns the corresponding decimal value based on xl , xu and q.
3. Write a MATLAB function y = fn1(x) / y = fn2(x) / y = fn3(x) that returns the objective function value for x.
4. Initialize the population using uniformly distributed random numbers. You may declare a N × q matrix
B that stores the set of solution strings in the population, in which each row represents a particular
solution string.
5. Find fitness value for each solution string. Store these in an N × 1 vector F .
6. Perform reproduction and selection based on Roulette Wheel method. For this, you may store the
probability values in a column vector P , cumulative probabilities in a vector CP and the ranges for
selections in a N × 2 matrix Range. Update the population B executing selection process.
7. Randomly select mating pairs from B and perform single point crossover. Select crossover site randomly
for each mating pair. Store new offsprings in N × q matrix Bd.
8. Append Bd to B and store in Bdd (2N × q matrix). Find fitness values for all solution strings in Bdd.
Select best N solution strings from Bdd and store that in B.

9. Perform mutation on B.
10. Repeat Step 5 - Step 9 until maximum iterations is reached.
EE6243/EE637 Assignment 4 Page 2 of 2

Output: For the given optimization problems

1. Make a table indicating

• Iteration number k.
• Best solution string.
• Corresponding fitness value.
2. Plot best fitness value Vs. k.

3. Plot best solution Vs. k.


4. Run the program (GA) 100 times and note the global maxima generated in each run (denote different
trials as run-1, run-2, . . . run-100).
5. Plot global maxima Vs. run-number.

6. Find the average value and the standard deviation of the set of global maxima obtained in 4.

Deadline: Programs must be finished and demonstrated on or before 6th September 2019.

You might also like