[CS logo]

CMSC 25000 - Artificial Intelligence
Winter 2007
Homework #4: Due February 1, 2007


Goals

Through this assignment you will:

Background:

Genetic algorithms are inspired by a biological analogy with Darwin's theory of evolution as a mechanism for local search and learning. In evolution, variation arises through random mutation and also through crossover which mixes chromosomal material from two parents. Individuals, or in Dawkins' view genes, are filtered through the process of natural selection or "survival of the fittest."

Genetic algorithms map the structure of the search problem onto evolutionary analogs. The parameters of the search space correspond to genes and together form chromosomes. Mutation randomly changes randomly selected feature values, and crossover combines subsets of parameters from two existing chromosomes. Selection is elemented through a fitness measure which biases the choice of chromosomes to appear in the next generation. We presented three different fitness functions - the standard method, the rank method, and the rank-space method - which incorporate measures of quality, and possibly additionally diversity.

Problem 1: Mastermind

Mastermind is a game in which one player constructs a sequence of colored pegs, which are not seen directly by the other player. The other player's goal is to reconstruct the sequence of colored pegs based on limited feedback (number of correct colors, number of correctly positioned pegs). Here we will use GAs to evolve a solution to Mastermind.

In this variant of the game, the pegs will take on the colors of the rainbow: red, orange, yellow, green, blue, indigo, violet. Since we have all the processing power of a computer to solve this problem, we will try to guess a longer than typical string, 20 pegs in length, "rgybvgbiyoroggviiybo".

You will find the code to implement a genetic algorithm in ga.scm. Running the GA involves setting up the problem and then using genetic_algorithm to run the GA search. This function requires: