MOGAL
|
00001 /* 00002 00003 This file is a part of MOGAL, a Multi-Objective Genetic Algorithm 00004 Library. 00005 00006 Copyright (C) 2008-2012 Jori Liesenborgs 00007 00008 Contact: jori.liesenborgs@gmail.com 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00023 USA 00024 00025 */ 00026 00031 #ifndef MOGAL_GAFACTORYSINGLEOBJECTIVE_H 00032 00033 #define MOGAL_GAFACTORYSINGLEOBJECTIVE_H 00034 00035 #include "mogalconfig.h" 00036 #include "gafactorydefaults.h" 00037 #include <algorithm> 00038 00039 namespace mogal 00040 { 00041 00052 class MOGAL_IMPORTEXPORT GAFactorySingleObjective : public GAFactoryDefaults 00053 { 00054 protected: 00055 GAFactorySingleObjective() { } 00056 public: 00057 ~GAFactorySingleObjective() { } 00058 00059 size_t getNumberOfFitnessComponents() const { return 1; } 00060 void introduceMutations(std::vector<GenomeWrapper> &newPopulation); 00061 void breed(const std::vector<GenomeWrapper> &population, std::vector<GenomeWrapper> &newPopulation); 00062 void sort(std::vector<GenomeWrapper> &population) { std::sort(population.begin(), population.end()); } 00063 void updateBestGenomes(std::vector<GenomeWrapper> &population); 00064 Genome *selectPreferredGenome(const std::list<Genome *> &bestGenomes) const; 00065 }; 00066 00067 } // end namespace 00068 00069 #endif // MOGAL_GAFACTORYSINGLEOBJECTIVE_H 00070