Expressions

25 points.

Mathematical expressions, encoded as trees, are another good technique for endowing your creatures with life.

For this problem, we are trying to guess the next number in a sequence of numbers. We know that the sequence is defined by some mathematical function, but we are at a loss to determine what that function is.

See section 2.1 in the textbook for more information.

  1. Find an encoding for your genome. It is likely that you'll want to use the tree types built into the GAlib.

  2. Choose your set of functions and terminals. Good candidates for functions include +, -, *. Good candidates for terminals include 1, 2, 3, ... 10, and of course the input variable x.

  3. Build an evaluator function for your expressions. It should take as input a variable real number, and return a real number.

  4. Create a fitness function that tests the expression against the sequence given in the file sequence.

Extra Credit - Create a generalized expression genome class. The user should be able to specify any number and type of functions and terminals. Include a customized crossover and mutation function, and compare their effectiveness to the built-ins. (15 points.)

Best Credit - Be the first to determine the next number in the sequence. (5 points.)

Files for the project are available here.