1
CEE 5290/CS 5722/ORIE 5340: Heuristic Methods for Optimization
Homework 3: Binary Genetic Algorithm
Assigned: Wednesday, September 14, 2010
Due: Friday, September 23, 2010
TA Office Hours: Thu, Sep 15
th
(3:004:30), Tue, Sep 20
th
(10:0011:00am), Thu, Sep 22
nd
(3:004:30)
in Hollister 203
Prof. Shoemaker office hours: 2:303:30 on Fri 9/15, M 9/19, and Tu 9/21 in Hollister 210
1.
If you wish to improve any of the basic approaches specified by the GA then feel free to do so – creativity
is a small consideration in your final grade.
In these cases, make sure you first answer the specific
homework questions and then briefly describe, provide code and compare your new approach to the
approach requested in the question.
Provide this material in an appendix.
2.
Marks may be deducted for a lack of neatness.
The modified pseudocode from the text is as follows:
1
Procedure (
Genetic Algorithm
)
2
M = population size
% number of possible solutions at any instance
3
N
g
= number of generations
% number of iterations
4
N
o
= number of offspring
% to be generated by crossover
5
P
μ
= mutation probability
% Also called mutation rate (M
r
)
6
P
ß
Ξ
(M)
% Construct initial population, P
Ξ
is the population constructor
7
For j=1:M
8
Evaluate f(P[j])
% Evaluate fitness of all individuals
% This is done before the GA algorithm is implemented
9
Endfor
10
Start
Genetic Algorithm
11
For i=1:N
g
12
For j=1: N
o
13
(x,y)
ß
ϕ
(P)
%Select two parents x and y from current population
14
Offspring[j]
ß
χ
(x,y)
% Generate offspring by crossover of parents x and y
15
EndFor
16
For i=1: N
17
Mutated[j]
ß
μ(y)
% With probability P
μ
apply mutation all the offspring
18
EndFor
19
Evaluate fitness for offspring after crossover and mutation
%CORRECTED
20
P
ß
select (P, offspring)
%Select best M solutions from parents and offspring
21
End (
Genetic algorithm
)
% CORRECTED
22
Return highest scoring configuration in P
23
End
1.
This question will cover the optimization of a simple cost function using binary representation with
Genetic Algorithms.
Note that by convention, GAs are coded to maximize the fitness function.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document2
Consider the 2D cost function used in Homework 2:
F(s1,s2) = 10^9(625(s125)^2) *(1600(s210)^2)*sin((s1)*pi/10)*sin((s2)*pi/10)
For question 1 here we will
maximize
this function.
The global
maximum
is F(125,115) = 1088359375.
Since each decision variable can take on integer values from 0 to 127, the input variables s1 and s2 can
each be represented by 7bit binary string. Hence the domain of this cost function can be represented by
a 14bit binary string as, s = [sb
1
, sb
2
, .
.. sb
14
], where the first seven elements form the binary
representation of s1 and the last seven bits represent s2. i.e.
∑
=
−
=
7
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '11
 Shoemaker

Click to edit the document details