// This file is a part of Framsticks SDK. http://www.framsticks.com/ // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. // See LICENSE.txt for details. #ifndef _GENMAN_H_ #define _GENMAN_H_ #include #include #include #include #include #include "geno.h" #include "oper_fx.h" #define GENSTYLE_COMMENT GENSTYLE_RGBS(0,150,0,GENSTYLE_BOLD) struct GenoLink { int count; string parent1, parent2, child; //parent2 only used in crossover, it is "" in mutation float chg; float fit; }; class GenMan : public GenoValidator { public: GenMan(); ~GenMan(); void setDefaults(); /** if canvalidate==false, returns GENOPER_NOOPER (cannot test), GENOPER_OK (\e g is valid), or 1-based error position. if canvalidate==true, returns - GENOPER_OK and canvalidate==false if \e g was already valid - GENOPER_NOOPER and canvalidate==false if \e g was (probably) validated but couldn't checkValidity - 1-based error position and canvalidate==false if \e g was invalid and couldn't validate - 1-based error position and canvalidate==true if \e g was invalid and was validated successfully Note: 1-based error position is always related to pure genotype (g.GetGene()), without the leading comment */ int testValidity(Geno &g, bool &canvalidate); int testGenoValidity(Geno& g); //class GenoValidator (geno.h) Geno Validate(const Geno&); ///& GetOperators() const { return oper_fx_list; } /// oper_fx_list; void saveLink(const string parent1, const string parent2, const string child, const float chg); GenoOperators* getOper_f(char format); string HTMLize(const char *g, bool shorten); public: vector GenoLinkList; int history; //remember history? int hilite; //syntax highlighting (Style) int extmutinfo; //extended info: the info field of the genotype will contain the name of the mutation method int count; //# of the last genetic operation int valid_m, valid_xo, validated_m, validated_xo, invalid_m, invalid_xo, failed_m, failed_xo; double mutchg, xochg; SListTempl operformats; //the list of supported_format, in the same order as in seloperpar int* seloper; //fields for seloperpar Param localpar, localstats; MutableParam seloperpar; GeneticNeuroParam neuronsparam; MutableParamList par; #define STATRICKCLASS GenMan PARAMPROCDEF(p_clearStats); PARAMPROCDEF(p_report); PARAMPROCDEF(p_htmlize); PARAMPROCDEF(p_htmlizeshort); PARAMPROCDEF(p_validate); PARAMPROCDEF(p_mutate); PARAMPROCDEF(p_crossover); PARAMPROCDEF(p_getsimplest); #undef STATRICKCLASS void clearStats(); static void onDelGen(void*, intptr_t); }; #endif