{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3 - HW3 solutions Fall 2010 Points possible 20 1 Maximize...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
HW3 solutions Fall 2010 1 Points possible : 20 1. Maximize the following function: F(s1,s2) = 10^9-(625-(s1-25)^2) *(1600-(s2-10)^2)*sin((s1)*pi/10)*sin((s2)*pi/10) The global maximum is F(125,115) = 1088359375. a. (6 points, 1 for each algorithm) Write a MATLAB function to implement a Genetic Algorithm GA.m. Mark for completion students should have a GA code that is similar to what is shown in the pseudocode. Cost for the initial population should be calculated and stored. Some other comments about other functions: fitness.m - to calculate the fitness of individual solutions (this is very simple code that calls your cost function and, if necessary, converts problem to minimization) selection_R . m - which takes a population and generates parents from it using fitness proportional selection Note that the selection procedure described in lecture is equivalent to using a weighted roulette wheel with slots proportional to the fitness of each member; Check that both parents should be selected according to their proportional fitness. Parent1 should not be the same as parent 2 (Deduct ½ points) . Otherwise, the two children generated will be the same, effectively carrying over 2 of the same individual to the next population. You want to search over a wider range, so that you are more likely to find the best solution faster. crossover . m - which performs single-point crossover at a randomly generated point along the string (14 bit here) and generates two children or offspring per pair of parents; and According to these instructions, the crossover should be implemented as choosing one point along the entire 14-bit string and implementing crossover for the entire sting, not taking into account the two different numbers (Method 1). However, some students will restrict the crossover point to be between the 1st and 7th binary digits, then perform multivariate crossover as covered in class (Method 2). Both methods are OK. mutation.m - which mutates each bit (bit-wise mutation) in the string with a probability of pMutation . Make sure that each bit is mutated with probability pMutation. If not, deduct ½ points . Also code your GA.m function to use Elitism . Elitism is when the m highest fitness individuals ( m <popsize) from the previous generation are always carried forward, undisturbed into the next generation. Here, use m =1 (only best individual is carried forward). Code this as you see fit in the GA.m file. There are many ways to implement elitism. Students can randomly select a child from the next generation population and replace it with the elite parent. Students can also select the worst child from the next generation population and replace it with the elite parent. Both are OK.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
HW3 solutions Fall 2010 2 b. (1 point) Run GA 30 times on the fitness function described above with a population size of 20, for 50 generations, using a pCrossover=0.9 and pMutation=1/20=0.05 (you will experiment with GA parameters in a later homework). This is probably easiest if you first generate all 30 initial solutions sets and then call the GA.m within a loop 30 times, each time using one of the 30 initial solutions generated
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern