Ignore:
Timestamp:
04/11/18 01:16:08 (6 years ago)
Author:
Maciej Komosinski
Message:

Removed unused "state" field (issue number 19), improved docs (issues number 20,21,23), code formatting (issue number 24) [closes #62]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/f4/oper_f4.cpp

    r773 r774  
    6767}
    6868
    69 int Geno_f4::ValidateRec(f4_node * geno, int retrycount) const
     69int Geno_f4::ValidateRec(f4_node *geno, int retrycount) const
    7070{
    7171        // ! the genotype is geno->child (not geno) !
     
    113113
    114114
    115 int Geno_f4::checkValidity(const char * geno, const char *genoname)
     115int Geno_f4::checkValidity(const char* geno, const char *genoname)
    116116{
    117117        f4_node root;
     
    164164                        {
    165165                                // make neuron
    166                                 NeuroClass * rndclass = GenoOperators::getRandomNeuroClass();
     166                                NeuroClass *rndclass = GenoOperators::getRandomNeuroClass();
    167167                                if (rndclass == NULL)
    168168                                {
     
    177177                                                for (int i = 0; i < g->count(); i++)
    178178                                                {
    179                                                         f4_node * gcur = g->ordNode(i);
    180                                                         char * temp = (char*)gcur->name.c_str();
    181                                                         NeuroClass * neuclass = GenoOperators::parseNeuroClass(temp);
     179                                                        f4_node *gcur = g->ordNode(i);
     180                                                        char* temp = (char*)gcur->name.c_str();
     181                                                        NeuroClass *neuclass = GenoOperators::parseNeuroClass(temp);
    182182                                                        if (neuclass != NULL)
    183183                                                        {
     
    215215                {
    216216                        // add link
    217                         f4_node * par = n1->parent;
    218                         char * temp = (char*)par->name.c_str();
    219                         NeuroClass * neuclass = GenoOperators::parseNeuroClass(temp);
     217                        f4_node *par = n1->parent;
     218                        char* temp = (char*)par->name.c_str();
     219                        NeuroClass *neuclass = GenoOperators::parseNeuroClass(temp);
    220220                        if (neuclass != NULL)
    221221                        {
     
    456456
    457457// change a [ node
    458 void Geno_f4::linkNodeChangeRandom(f4_node * nn, int neuid, std::vector<NeuroClass*> neulist) const      //rewritten by M.K. - should work as before (not tested)
     458void Geno_f4::linkNodeChangeRandom(f4_node *nn, int neuid, std::vector<NeuroClass*> neulist) const      //rewritten by M.K. - should work as before (not tested)
    459459{
    460460        double probs[3] = { 0.1, 0.3, 0.6 };
     
    495495
    496496// make a random : node
    497 void Geno_f4::nparNodeMakeRandom(f4_node * nn) const
     497void Geno_f4::nparNodeMakeRandom(f4_node *nn) const
    498498{
    499499        int sign = (int)(2.0f * rnd01);
     
    505505
    506506// change a repeat # node
    507 void Geno_f4::repeatNodeChangeRandom(f4_node * nn) const
     507void Geno_f4::repeatNodeChangeRandom(f4_node *nn) const
    508508{
    509509        int count;
     
    526526        // ! the genotype is g->child (not g) !
    527527        int i, res;
    528         f4_node * gcopy = NULL;
     528        f4_node *gcopy = NULL;
    529529        // try this max 20 times:
    530530        //   copy, mutate, then validate
     
    600600
    601601// convert to tree
    602 f4_node * root;
     602f4_node *root;
    603603root = new f4_node();
    604604res = f4_processrec(g, 0, root);
     
    654654
    655655
    656 int Geno_f4::CrossOverOne(f4_node * g1, f4_node * g2, float chg) const
     656int Geno_f4::CrossOverOne(f4_node *g1, f4_node *g2, float chg) const
    657657{
    658658        // ! the genotypes are g1->child and g2->child (not g1 g2) !
     
    660660        int smin, smax;
    661661        float size;
    662         f4_node * n1, *n2, *n1p, *n2p;
     662        f4_node *n1, *n2, *n1p, *n2p;
    663663
    664664        // determine desired size
Note: See TracChangeset for help on using the changeset viewer.