Changeset 121 for cpp/frams/genetics


Ignore:
Timestamp:
02/08/14 06:00:41 (11 years ago)
Author:
sz
Message:

updated file headers and makefiles

Location:
cpp/frams/genetics
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/defgenoconv.cpp

    r109 r121  
     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
    15#include "defgenoconv.h"
    26
     
    48
    59#ifdef USE_GENCONV_F10
    6 #include "conv/conv_f1.h"
     10#include "f1/conv_f1.h"
    711#endif
    812#ifdef USE_GENCONV_F20
    9 #include "conv/conv_f2.h"
     13#include "f2/conv_f2.h"
    1014#endif
    1115#ifdef USE_GENCONV_F32
    12 #include "conv/conv_f3.h"
     16#include "f3/conv_f3.h"
    1317#endif
    1418#ifdef USE_GENCONV_F40
    15 #include "conv/conv_f4.h"
     19#include "f4/conv_f4.h"
    1620#endif
    1721#ifdef USE_GENCONV_F41_TEST
    18 #include "conv/conv_f4.h"
     22#include "f4/conv_f4.h"
    1923#endif
    2024#ifdef USE_GENCONV_F50
    21 #include "conv/conv_f5.h"
     25#include "f5/conv_f5.h"
    2226#endif
    2327#ifdef USE_GENCONV_F60
    24 #include "conv/geno_f6.h"
     28#include "f6/geno_f6.h"
    2529#endif
    2630#ifdef USE_GENCONV_F70
    27 #include "conv/conv_f7.h"
     31#include "f7/conv_f7.h"
    2832#endif
    2933#ifdef USE_GENCONV_F81
    30 #include "conv/conv_f8tof1.h"
     34#include "f8/conv_f8tof1.h"
    3135#endif
    3236#ifdef USE_GENCONV_F90
    33 #include "conv/conv_f9.h"
     37#include "f9/conv_f9.h"
    3438#endif
    3539
  • cpp/frams/genetics/defgenoconv.h

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2011 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
  • cpp/frams/genetics/f1/conv_f1.cpp

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2013 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
  • cpp/frams/genetics/f1/conv_f1.h

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2011 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
     
    66#define _CONV_F1_H
    77
    8 #include <frams/genetic/genoconv.h>
     8#include <frams/genetics/genoconv.h>
    99#include <frams/model/model.h>
    1010
     
    7575
    7676#endif
    77 
    78 
    79 
    80 
    81 
  • cpp/frams/genetics/gen-config-GDK.h

    r109 r121  
    1 // This file is a part of the Framsticks GDK library. See LICENSE.txt for details.
     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.
    23// Refer to http://www.framsticks.com/ for further information.
     4
    35
    46/**
     
    1618//#define USE_GENCONV_F41_TEST
    1719//#define USE_GENCONV_F50
     20#define USE_GENCONV_F90
    1821
    1922//#define USE_GENMAN_F0
  • cpp/frams/genetics/geno.cpp

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2011 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
  • cpp/frams/genetics/geno.h

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2011 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
  • cpp/frams/genetics/genoconv.cpp

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2011 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
  • cpp/frams/genetics/genoconv.h

    r109 r121  
    1 // This file is a part of the Framsticks GDK library.
    2 // Copyright (C) 2002-2011 Szymon Ulatowski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
  • cpp/frams/genetics/oper_fx.cpp

    r119 r121  
    1 // This file is a part of the Framsticks GenoFX library.
    2 // Copyright (C) 2002-2011  Maciej Komosinski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
    55#include <ctype.h>  //isupper()
    6 #include "geno_fx.h"
     6#include "oper_fx.h"
    77#include <common/framsg.h>
    88#include <common/nonstd_math.h>
     
    3333
    3434
    35 int Geno_fx::roulette(const double *probtab,const int count)
     35int GenoOperators::roulette(const double *probtab,const int count)
    3636{
    3737   double sum=0;
     
    4343}
    4444
    45 bool Geno_fx::getMinMaxDef(ParamInterface *p,int i,double &mn,double &mx,double &def)
     45bool GenoOperators::getMinMaxDef(ParamInterface *p,int i,double &mn,double &mx,double &def)
    4646{
    4747   mn=mx=def=0;
     
    6868}
    6969
    70 int Geno_fx::selectRandomProperty(Neuro* n)
     70int GenoOperators::selectRandomProperty(Neuro* n)
    7171{
    7272   int neuext=n->extraProperties().getPropCount(),
     
    7878}
    7979
    80 double Geno_fx::mutateNeuProperty(double current,Neuro *n,int i)
     80double GenoOperators::mutateNeuProperty(double current,Neuro *n,int i)
    8181{
    8282   if (i==-1) return mutateCreepNoLimit('f',current,-10,10); //i==-1: mutating weight of neural connection
     
    8989}
    9090
    91 bool Geno_fx::mutatePropertyNaive(ParamInterface &p,int i)
     91bool GenoOperators::mutatePropertyNaive(ParamInterface &p,int i)
    9292{
    9393   double mn,mx,df;
     
    102102}
    103103
    104 bool Geno_fx::mutateProperty(ParamInterface &p,int i)
     104bool GenoOperators::mutateProperty(ParamInterface &p,int i)
    105105{
    106106   double newval;
     
    112112}
    113113
    114 bool Geno_fx::getMutatedProperty(ParamInterface &p,int i,double oldval,double &newval)
     114bool GenoOperators::getMutatedProperty(ParamInterface &p,int i,double oldval,double &newval)
    115115{
    116116   newval=0;
     
    128128}
    129129
    130 double Geno_fx::mutateCreepNoLimit(char type,double current,double mn,double mx)
     130double GenoOperators::mutateCreepNoLimit(char type,double current,double mn,double mx)
    131131{
    132132   double result=RndGen.Gauss(current,(mx-mn)/2/5); // /halfinterval, 5 times narrower
     
    136136}
    137137
    138 double Geno_fx::mutateCreep(char type,double current,double mn,double mx)
     138double GenoOperators::mutateCreep(char type,double current,double mn,double mx)
    139139{
    140140   double result=mutateCreepNoLimit(type,current,mn,mx); //TODO consider that when boundary is touched (reflect/absorb below), the default precision (3 digits) may change. Is it good or bad?
     
    148148}
    149149
    150 NeuroClass* Geno_fx::getRandomNeuroClass()
     150NeuroClass* GenoOperators::getRandomNeuroClass()
    151151{
    152152        SListTempl<NeuroClass*> active;
     
    156156}
    157157
    158 NeuroClass* Geno_fx::parseNeuroClass(char*& s)
     158NeuroClass* GenoOperators::parseNeuroClass(char*& s)
    159159{
    160160   int len=strlen(s);
     
    171171}
    172172
    173 Neuro* Geno_fx::findNeuro(const Model *m,const NeuroClass *nc)
     173Neuro* GenoOperators::findNeuro(const Model *m,const NeuroClass *nc)
    174174{
    175175  if (!m) return NULL;
     
    179179}
    180180
    181 int Geno_fx::neuroClassProp(char*& s,NeuroClass *nc,bool also_v1_N_props)
     181int GenoOperators::neuroClassProp(char*& s,NeuroClass *nc,bool also_v1_N_props)
    182182{
    183183   int len=strlen(s);
     
    213213}
    214214
    215 bool Geno_fx::isWS(const char c)
     215bool GenoOperators::isWS(const char c)
    216216{return c==' ' || c=='\n' || c=='\t' || c=='\r';}
    217217
    218 void Geno_fx::skipWS(char *&s)
    219 { if (!s) FramMessage("Geno_fx","skipWS","NULL reference!",1); else
     218void GenoOperators::skipWS(char *&s)
     219{ if (!s) FramMessage("GenoOperators","skipWS","NULL reference!",1); else
    220220     while (isWS(*s)) s++;
    221221}
    222222
    223 bool Geno_fx::areAlike(char *g1,char *g2)
     223bool GenoOperators::areAlike(char *g1,char *g2)
    224224{
    225225        while (*g1 || *g2)
     
    235235}
    236236
    237 char* Geno_fx::strchrn0(const char *str,char ch)
     237char* GenoOperators::strchrn0(const char *str,char ch)
    238238{ return ch==0?NULL:strchr((char*)str,ch); }
    239239
    240 bool Geno_fx::isNeuroClassName(const char firstchar)
     240bool GenoOperators::isNeuroClassName(const char firstchar)
    241241{
    242242   return isupper(firstchar) || firstchar=='|' || firstchar=='@' || firstchar=='*';
  • cpp/frams/genetics/oper_fx.h

    r119 r121  
    1 // This file is a part of the Framsticks GenoFX library.
    2 // Copyright (C) 2002-2011  Maciej Komosinski.  See LICENSE.txt for details.
     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.
    33// Refer to http://www.framsticks.com/ for further information.
    44
    5 #ifndef _GENO_FX_H_
    6 #define _GENO_FX_H_
     5#ifndef _GENO_OPERATORS_H_
     6#define _GENO_OPERATORS_H_
    77
    88#include <common/nonstd.h>
     
    4949
    5050When designing genetic operations on some representation, inherit your class
    51 (for example Geno_fMy) from Geno_fx. Define some methods,
     51(for example GenoOper_fMy) from GenoOperators. Define some methods,
    5252like mutate(), in your class, to allow for evolution.
    5353Ensure they have the same names and arguments as the corresponding
     
    7777the available source on developmental encoding and f4 genotype format.*/
    7878
    79 class Geno_fx
     79class GenoOperators
    8080{
    8181 public:
     
    8484   SString name; ///<name of this set of genetic operators
    8585   char **mutation_method_names; ///<array of names for mutation methods. If initialized (by new char*[]), must have entries for each method index returned by mutate(geno,chg,METHOD).  If initialized, it is automatically freed by this destructor.
    86    Geno_fx() : par(empty_paramtab) {supported_format='x'; name="Default"; mutation_method_names=NULL; setDefaults();}
     86   GenoOperators() : par(empty_paramtab) {supported_format='x'; name="Default"; mutation_method_names=NULL; setDefaults();}
    8787
    8888/**Used to perform initializations of Param parameters that are not handled by the Param itself
     
    172172///currently not used (similarity of two genotypes)
    173173   virtual float similarity(const char*,const char*) {return GENOPER_NOOPER;}
    174    virtual ~Geno_fx() {if (mutation_method_names) {delete []mutation_method_names; mutation_method_names=NULL;}}
     174   virtual ~GenoOperators() {if (mutation_method_names) {delete []mutation_method_names; mutation_method_names=NULL;}}
    175175//   virtual char getFormat() {return 255;} //returns supported genotype format, for ex. '1'
    176176//   virtual int enabled() {return 1;} // should be enabled by default
     
    178178/** \name Some helpful methods for you */
    179179//@{
    180         static int roulette(const double *probtab,const int count);    ///<returns random index according to probabilities in the \e probtab table or -1 if all probs are zero. \e count is the number of elements in \e probtab.
     180  static int roulette(const double *probtab,const int count);  ///<returns random index according to probabilities in the \e probtab table or -1 if all probs are zero. \e count is the number of elements in \e probtab.
    181181   static bool getMinMaxDef(ParamInterface *p,int propindex,double &mn,double &mx,double &def); ///<perhaps a more useful (higher-level) way to obtain min/max/def info for integer and double properties. Returns true if min/max/def was really available (otherwise it is just invented).
    182182   static int selectRandomProperty(Neuro* n); ///<selects random property (either 0-based extraproperty of Neuro or 100-based property of its NeuroClass). -1 if Neuro has no properties.
     
    194194   static void skipWS(char *&s); ///<advances pointer \e s skipping whitespaces.
    195195   static bool areAlike(char*,char*); ///<compares two text strings skipping whitespaces. Returns 1 when equal, 0 when different.
    196          static char* strchrn0(const char *str,char ch); ///<like strchr, but does not find zero char in \e str.
     196   static char* strchrn0(const char *str,char ch); ///<like strchr, but does not find zero char in \e str.
    197197   static bool isNeuroClassName(const char firstchar); ///<determines if \e firstchar may start NeuroClass name. If not, it may start NeuroClass' (or Neuro's) property name.
    198198//@}
     
    216216
    217217#endif
    218 
Note: See TracChangeset for help on using the changeset viewer.