00001 /* 00002 Teem - an open source evolutionary software framework 00003 http://lis.epfl.ch/resources/Teem 00004 Stephane Magnenat <stephane.magnenat@epfl.ch>, 00005 Antoine Beyeler <antoine.beyeler@epfl.ch>, 00006 and other contributors. See AUTHORS for details 00007 Laboratory of Intelligent Systems, EPFL, Lausanne 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #ifndef __GENOME_H 00025 #define __GENOME_H 00026 00027 #include <ishtar/settings.h> 00028 00033 namespace Teem 00034 { 00037 class Genome 00038 { 00039 public: 00041 enum GenomeType 00042 { 00043 BIT_GENOME = 0, 00044 SIMPLE_GROWABLE_GENOME, 00045 }; 00047 bool disableAssertion; 00049 bool error; 00050 00051 public: 00053 virtual ~Genome() { } 00055 virtual void randomize(void) = 0; 00057 virtual void mutate(void) = 0; 00059 virtual void cross(const Genome *other) = 0; 00061 virtual Genome *clone(void) = 0; 00062 00064 virtual void save(Ishtar::OutputStream *stream) = 0; 00065 00067 static Genome *create(GenomeType type, size_t size, bool disableAssertion = false); 00069 static Genome *load(Ishtar::InputStream *stream, bool disableAssertion = false); 00070 }; 00071 } 00072 00073 #endif