Changeset 714 for cpp/frams/genetics


Ignore:
Timestamp:
11/05/17 21:45:20 (3 years ago)
Author:
Maciej Komosinski
Message:
  • Setting default NeuroClass? active/genactive in preconfigured genetics
  • genactive becomes bool (was int)
  • Code formatting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/preconfigured.h

    r551 r714  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2017  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1515class PreconfiguredGenetics
    1616{
    17   public:
    18 DefaultGenoConvManager gcm;
    19 GenMan genman;
    20 Geno::Validators validators;
    21 ModelGenoValidator model_validator; //validation through conversion
     17public:
     18        DefaultGenoConvManager gcm;
     19        GenMan genman;
     20        Geno::Validators validators;
     21        ModelGenoValidator model_validator; //validation through conversion
    2222
    23 PreconfiguredGenetics()
     23        PreconfiguredGenetics()
    2424        {
    25         gcm.addDefaultConverters(); //without converters, the application would only handle "format 0" genotypes
    26         if (Geno::useConverters(&gcm)!=NULL)
    27                 logPrintf("PreconfiguredGenetics", "init", LOG_WARN, "Geno converters already configured"); //someone is using multiple PreconfiguredGenetics objects? (or other potentially unsafe configuration)
    28         if (Geno::useValidators(&validators)!=NULL)
    29                 logPrintf("PreconfiguredGenetics", "init", LOG_WARN, "Geno validators already configured");
    30         validators+=&genman; //primary validation: use the extended validity checking (through dedicated genetic operators)
    31         validators+=&model_validator; //secondary validation: this simple validator handles all cases when there is no dedicated genetic validation operator, but a converter for a particular format is available. Converters may be less strict in detecting invalid genotypes but using them and checking whether they produced a valid f0 genotype is also some way to tell whether the initial genotype was valid. Otherwise, without dedicated genetic validation operator, we would have no validity check at all.
     25                gcm.addDefaultConverters(); //without converters, the application would only handle "format 0" genotypes
     26                if (Geno::useConverters(&gcm) != NULL)
     27                        logPrintf("PreconfiguredGenetics", "init", LOG_WARN, "Geno converters already configured"); //someone is using multiple PreconfiguredGenetics objects? (or other potentially unsafe configuration)
     28                if (Geno::useValidators(&validators) != NULL)
     29                        logPrintf("PreconfiguredGenetics", "init", LOG_WARN, "Geno validators already configured");
     30                static const char* genactive_classes[] = { "N", "G", "T", "S", "*", "|", "@", NULL };
     31                NeuroClass::resetActive();
     32                NeuroClass::setGenActive(genactive_classes);
     33                validators += &genman; //primary validation: use the extended validity checking (through dedicated genetic operators)
     34                validators += &model_validator; //secondary validation: this simple validator handles all cases when there is no dedicated genetic validation operator, but a converter for a particular format is available. Converters may be less strict in detecting invalid genotypes but using them and checking whether they produced a valid f0 genotype is also some way to tell whether the initial genotype was valid. Otherwise, without dedicated genetic validation operator, we would have no validity check at all.
    3235        }
    3336
    34 ~PreconfiguredGenetics()
     37        ~PreconfiguredGenetics()
    3538        {
    36         Geno::useConverters(NULL);
    37         Geno::useValidators(NULL);
     39                Geno::useConverters(NULL);
     40                Geno::useValidators(NULL);
    3841        }
    3942};
Note: See TracChangeset for help on using the changeset viewer.