Galapagos ...by
Andy Meneely |
Examples
| IntGenome
| CompGenome
| SineGenome
| DioGenome Tutorials | Exercises | Operators | Runner | Javadoc |
|
IntGenome The IntGenome is a very boring example. In fact, that's why everything is introduced using IntGenome - so that it's easier to focus on Galapagos and to not get hung up on the details of IntGenome. Here's a brief description: The problem: Guess the number 519. The hint I give you is how close you are. The encoding: The meaning of an IntGenome's list of numbers is actually one very big number. Every entry of the list is a digit, 0 to 9, and the string together is the genome's guess. So the IntGenome which encodes for the number 162,450 can be created like this: IntGenome myIntGenome = new IntGenome(Arrays.asList(1,6,2,4,5,0)); The fitness: The fitness, (i.e. measurement of how good each genome is), is based on the difference. The smaller the difference, the closer we get, the better our fitness is. So the best possible genome is 519, and thus has the highest fitness (usually that means a very large number with all nines). Wait, can't we just add/subtract the fitness from our guess and
get 519?
|