CSD 3939 Home Page The Prior Page The Next Page
Middlesex Logo

Lab 5: GA to maximize digit gene.

  1. Make a population of genes of length 20 digits.
  2. Make a cross over function to create new genes.
  3. Make the simple evaluation function that returns the sum of the digits.
  4. Using cross-over and a population of 20 genes per generation, make a system that returns the best gene.
  5. Add mutation.
  6. Make an evaluation function that minimizes.
  7. Make a more interesting evaluation function. For instance, let the user type in a 20 digit number. Now make the evaluation function the digit by digit difference between the gene and user's number. Can you improve this function?
  8. Explore parameters of population size and mutation rate.