Using Neural Networks as Fitness Functions

<< Click to Display Table of Contents >>

Navigation:  Chapter 10 - Integrating Genetic Algorithms and Neural Networks >

Using Neural Networks as Fitness Functions

Previous pageReturn to chapter overviewNext page

For many complex problems it will not be possible to know or develop the fitness function mathematically.  You may be able to measure or test the fitness of various solutions, but it will often be impossible to derive any type of formula to represent the fitness.


Neural networks, however, can be trained to find the fitness function if there are enough available samples of fitnesses already measured.  Both the NeuroShell Run-Time Server and NeuroShell 2 have functions which can be executed from Excel spreadsheets to fire these neural networks so that they can become the GeneHunter fitness function.


Here an example is worth a thousand words.  Suppose you are a dairy farmer with a very large herd of cows.  You have noticed that different variations of feed cause the cows in your herd to produce different amounts of milk.  In fact, you have been feeding your cows a mixture of several ingredients, primarily corn silage, alfalfa hay, high morsel corn, shell corn, soybean meal, oats, barley, regular hay, beef broth, and molasses.  Since there are 10 different feeds in the mixture, it is very difficult to see the relationships.  You would like to find an optimal mixture in order to maximize milk production.  Fortunately, you have kept records for many months where you have recorded the mixtures fed to the cows and the corresponding milk production resulting from these mixtures.


You have carefully read this manual and examined the samples, so you know that you will set up the GeneHunter worksheet in Excel with 10 continuous chromosomes, each representing the percentage of the associated ingredient in the mix.



Figure 10.1  A genetic algorithm can optimize the feed mixture for cows in order to maximize milk production.


For each ingredient in the feed, there is a maximum and minimum range of percentage of that ingredient which you feel is safe and effective, so these will be the min/max restrictions for the 10 chromosomes.  Furthermore, the percentages obviously have to add up to 100 percent, so you set an additional restriction that the sum equal 100.


However, what should the fitness function be?  You probably aren't aware of any mathematical models of cow digestion and milk production.  This is where the neural net can be effective.  You build a network which has the mixture chromosomes as inputs (all 10 of them) and the milk production as an output.  In other words, given the mixture percentages, the network outputs the expected milk production when the cows are fed this mixture.  If you have a hundred or more examples (mixtures for training) of what happened with various (hopefully widely varying) feed mixtures, you should be able to build a fairly effective predictive net.  This net should be able to forecast what milk production to expect with any given new mixtures.  The network's success at this will probably depend upon how widely varied your training mixtures were.  Do not use a General Regression Neural Net (GRNN) because it is not capable of making predictions above those with which it was trained.  Backprop nets can do this to a limited extent.


If the network works, it is probably an excellent fitness "function".  Given a mixture (an individual from the GA), it can produce an expected milk volume, which you will want to maximize.  If you have used the NeuroShell Predictor to build your network, the optional Run-Time Server contains a function named x that allows you to call the network from a cell in an Excel worksheet.  If you have used NeuroShell 2 to build your network, simply use the Predict function provided with NeuroShell 2 to place the prediction into a cell.  This cell will be the fitness cell that GeneHunter will maximize.


Note:  the preceding example, though based on real research, is hypothetical.  Please do not feed your cows any of our feed mixtures!