It is difficult to find a domain where the chromosome and fitness function needed to solve a Genetic Algorithm problem are small enough and applicable for a "simple" weeklong homework assignment. Therefore, I am providing you with a fitness function that I do not expect you to understand - in fact, I don't want you to understand it. Instead you will simply work with this fitness function to find and trust its results.
Having said that, this homework is very manageable in size and difficulty and therefore makes a good chance for you to explore the key ideas of Genetic Algorithms easily.
For this homework you should write a program that fits the following requirements
For example, one sample run is illustrated below.
Some things to note:
You should also produce a version called gaParameters() that allows this to be launched with out the dynamic inputs. The example below is the exact same values as used above.
NOTE: You should program gaInputs() to take advantageof gaParameters().
Details on how to generate new chromosome's from population to population
In the reading from your textbook you read about three genetic operators - methods for moving chromosomes from one generation to the next.
The first two are almost always used. The third one is used in certain situations. I am also going to ask you to consider one additional operator:
Selecting a Chromosome to modify
In order to mimic nature and the concept of "survival" of the fittest" we need to come up with a technique which allows every chromosome at least a limited chance of being picked to undergo a genetic change through one of the methods explained above. But those chromosomes that are "fittest" (in our case, close to the target color) should have a much higher chance than those that aren't (those that are farther away).
For this particular assignment I would like you to use a technique known as "tournament selection" The concept is easy, although the implementation may be a bit harder.
To put this in an easy to understand context, let's consider five people who have just bowled a game of bowling. First, rank your bowlers (or, in the context of your GA, your chromosomes) based on their fitness. In this context the fitness is their score in the last round of the game.
Now, we want to select one of these bowlers, but we want to give preference for Ringo over John. The way we do this is:
If you think about this, you have 25 possible pairs of bowlers (5x5) and among this 25 pairings each bowler is selected at least once, although Ringo is going to be selected 9 of the 25 times while John will only be selected once.
|First Bowler Picked|
|Second Bowler Picked||Ringo||R||R||R||R||R|
You should use this technique for picking which chromosomes are used for selection and new blood. You should perform this techinique twice to see which two chromosomes are selected for crossover.
Prior to the deadline, use the homework submission system (https://www.cs.uni.edu/~schafer/submit/which_course.cgi) to upload any files you have produced. Make sure you submit all of the files needed to use your code.
In addition please submit to me a paper copy of your read me file at the start of the class on the due date.