Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

MaxIntProblem.h

Go to the documentation of this file.
00001 
00009 /*
00010  * Example set with GALib - A simple C++ library for Genetic Algorithms
00011  * Arthur van Dam <dam@math.uu.nl>
00012  * $Id: MaxIntProblem.h 441 2007-11-15 16:55:50Z adam $
00013  */
00014 #include "Problem.h"
00015 
00016 #include "IntChromosome.h"
00017 
00018 
00019 
00020 
00021 namespace gal {
00022 
00027     class MaxIntProblem : public Problem<int> {
00028     public:
00029         MaxIntProblem() : Problem<int>() {}
00030 
00031     public:
00035         Chromosome<int>* const constructChromosome(int chromoLength)
00036         {
00037 
00038             return new IntChromosome(chromoLength);
00039 
00040 
00041 
00042         }
00043 
00048         Chromosome<int>* const copyChromosome(Chromosome<int>* chromo)
00049         {
00050 
00051             /* We just use the copy constructor. */
00052 
00053             return new IntChromosome((IntChromosome&)*chromo);
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061         }
00062 
00063         void const deleteChromosome(Chromosome<int>* chromo)
00064         {
00065             delete (IntChromosome*)chromo;
00066         }
00067 
00071         double const evaluateObjective(Chromosome<int>* chromo)
00072         {
00073 
00074             /*** Return an objective value such that the integer
00075                  value represented by the chromosome is maximised.
00076             ***/
00077 
00078             return 0.0;
00079 
00080 
00081 
00082         }
00083         
00084     };
00085 
00086 }

Generated on Tue Oct 20 12:59:20 2009 for LabSci GALib optimisation by genetic algorithms, student version by  doxygen 1.3.9.1