You are on page 1of 2

NATIONAL INSTITUTE OF TECHNOLOGY ROURKELA

Department of Electrical Engineering


Assignment 2: Genetic Algorithm
Session: 2016 - 2017 (Autumn)
M.Tech 1st Semester and Dual Degree 7th Semester
Subject Name: Soft Computing Techniques
Subject Code: EE-637
General Instructions: Create a new folder and name it as your roll number. Save all files generated for this
assignment in that folder only. Zip the folder and attach for submission. Create a word document to show your results
(figures, tables etc.) Zip the file together. Three standard non-convex functions are randomly distributed among the
students. Refer the file student function.pdf for details. It will be sufficient to optimize the assigned function for
submission.

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
x cos(x) + 1
f2 = 4
50
sin2 (x) 0.5
f3 = 0.5
(1 + 0.001x2 )2

(1)
(2)
(3)

Consider the following design criteria:


x [10, 10].
Accuracy level x = 0.001.
Number of solution in the population N = 20.
Probability of mutation = 5%.
Maximum number of iterations = 20.
Guideline
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.

Contd.

Soft Computing Techniques

Genetic Algorithm

Page 2 of 2

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.

Report (to be submitted on or before 09.09.2016)


State the problem.
For the given objective function
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.

You might also like