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

updated file headers and makefiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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=='*';
Note: See TracChangeset for help on using the changeset viewer.