Changeset 196 for cpp/frams/genetics/f4/oper_f4.h
- Timestamp:
- 03/25/14 03:22:37 (11 years ago)
- Location:
- cpp/frams/genetics/f4
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified cpp/frams/genetics/f4/oper_f4.h ¶
r193 r196 1 /* 2 * geno_f4.h - f4 genetic operators. 3 * 4 * f4genotype - f4 format genotype conversions for FramSticks 5 * 6 * Copyright (C) 1999,2000 Adam Rotaru-Varga (adam_rotaru@yahoo.com) 7 * Copyright (C) 2001-2004 Maciej Komosinski 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2.1 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 23 */ 1 // This file is a part of the Framsticks GDK. 2 // Copyright (C) 2002-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. 3 // Refer to http://www.framsticks.com/ for further information. 4 5 // Copyright (C) 1999,2000 Adam Rotaru-Varga (adam_rotaru@yahoo.com), GNU LGPL 6 // Copyright (C) since 2001 Maciej Komosinski 24 7 25 8 #ifndef _GENO_F4_H_ 26 9 #define _GENO_F4_H_ 27 10 11 #include <stdio.h> 28 12 #include "f4_general.h" 29 #include "nonstd.h" 30 #include <stdio.h> 31 #include "geno_fx.h" 32 #include "param.h" 13 #include "common/nonstd.h" 14 #include "../oper_fx.h" 15 #include <frams/param/param.h> 33 16 34 17 … … 46 29 47 30 48 class Geno_f4 : public Geno_fx31 class Geno_f4 : public GenoOperators 49 32 { 50 33 public: 51 52 53 54 int mutate(char *& g, float & chg,int &method);55 56 char* getSimplest() {return "X";}; 57 34 Geno_f4(); 35 int validate(char *&); 36 int checkValidity(const char *); 37 int mutate(char *& g, float & chg, int &method); 38 int crossOver(char *&g1, char *&g2, float& chg1, float& chg2); 39 const char* getSimplest() { return "X"; } 40 unsigned long style(const char *g, int pos); 58 41 59 60 double prob[F4_COUNT],probadd[F4_ADD_COUNT];42 // mutation probabilities 43 double prob[F4_COUNT], probadd[F4_ADD_COUNT]; 61 44 62 45 protected: 63 /* int MutateMany(char *& g, float & chg); // not used anymore */64 65 int MutateOne(f4_node *& g,int &method) const;66 67 68 69 70 int MutateOneValid(f4_node * &g,int &method) const;71 72 73 46 /* int MutateMany(char *& g, float & chg); // not used anymore */ 47 int ValidateRec(f4_node * geno, int retrycount) const; 48 int MutateOne(f4_node *& g, int &method) const; 49 void linkNodeMakeRandom(f4_node * nn) const; 50 void linkNodeChangeRandom(f4_node * nn) const; 51 void nparNodeMakeRandom(f4_node * nn) const; 52 void repeatNodeChangeRandom(f4_node * nn) const; 53 int MutateOneValid(f4_node * &g, int &method) const; 54 int CrossOverOne(f4_node *g1, f4_node *g2, float chg) const; 55 // returns GENOPER_OK or GENOPER_OPFAIL 56 // chg: fraction of parent1 genes in child (in g1) (parent2 has the rest) 74 57 }; 75 58
Note: See TracChangeset
for help on using the changeset viewer.