next up previous contents
Next: About this document ... Up: Demos Previous: Symbolic regression of sine   Contents

Subsections

Compound interest

Please change directory to 'PERLGP_BASE/demos/interest' and look at the README file before running this demo.

Problem definition

Given the initial amount deposited in a bank, a fixed yearly deposit amount, the interest rate and the number of years invested, what is the final amount assuming a simple model of compound interest.

The fitness function is the root mean square deviation of the predicted final amount from the real final amount.

PerlGP approach

This is treated more like a modelling problem than the previous regression problem. The training data is generated by ./generate_data.pl and is read in with loadSet in the usual way. The grammar is constructed to allow looping and allows six variables to be manipulated: the four input variables and an additional two which are initialised to zero. Note how excessive looping is avoided with the use of the $z variable.

This demo has a nice simple refresh() method that you can look at. It also uses self-adapting NodeXoverProb and NodeMutationProb attributes.

This appears to be a challenging problem, because it is difficult to get good results without unfairly biasing the grammar to give the kind of programs you want to see. For example it is tempting to add a {VAR} += {NUM} statement. This is a common problem in genetic programming - the search space is large, local minima are prevalent, and CPU time and memory is limited, so it is tempting to push the system in the direction you think it should take. Another temptation is to use huge populations, but that changes the problem to a brute force search and evolution becomes less important.


next up previous contents
Next: About this document ... Up: Demos Previous: Symbolic regression of sine   Contents
Bob MacCallum 2003-02-03