00001 /*************************************************************************** 00002 chromosome.h - description 00003 ------------------- 00004 begin : Sat Apr 12 2003 00005 copyright : (C) 2003 by Onur Soysal 00006 email : soysal@ceng.metu.edu.tr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef CHROMOSOME_H 00019 #define CHROMOSOME_H 00020 00021 #include "nn.h" 00022 #include "serializable.h" 00023 00024 /*#define P_MUT 0.6 00025 // max number of mutation points 00026 #define N_MUT 3 00027 #define P_CROSS 0 00028 #define M_MUT 1*/ 00029 00030 00039 class Chromosome : public Serializable { 00040 public: 00044 NN genes; 00046 float fit; 00047 Chromosome(); 00048 ~Chromosome(); 00059 void mutate(float P_MUT,int N_MUT,float M_MUT); 00071 void cross(Chromosome &a,float P_CROSS); 00072 void virtual Serialize(FILE *f); 00073 void virtual Deserialize(FILE *f); 00074 }; 00075 00076 #endif
1.2.18