source: cpp/frams/genetics/fB/fB_oper.h @ 785

Last change on this file since 785 was 780, checked in by Maciej Komosinski, 7 years ago

Added sources for genetic encodings fB, fH, fL

File size: 1.7 KB
Line 
1#ifndef _FB_OPER_H_
2#define _FB_OPER_H_
3
4#include "../genooperators.h"
5
6/** @name Codes for general fB mutation types */
7//@{
8#define FB_SUBSTITUTION  0 ///<Relative probability of mutation by changing single random letter in genotype (substitution)
9#define FB_INSERTION     1 ///<Relative probability of mutation by inserting characters in random place of genotype
10#define FB_DELETION      2 ///<Relative probability of mutation by deleting random characters in genotype
11#define FB_DUPLICATION   3 ///<Relative probability of mutation by copying single *gene* of genotype and appending it to the beginning of this genotype
12#define FB_TRANSLOCATION 4 ///<Relative probability of mutation by replacing two substrings in genotype
13#define FB_MUT_COUNT     5 ///<Count of mutation types
14//@}
15
16/** @name Codes for fB cross over types */
17//@{
18#define FB_GENE_TRANSFER 0 ///<Relative probability of crossing over by transferring single genes from both parents to beginning of each other
19#define FB_CROSSING_OVER 1 ///<Relative probability of crossing over by random distribution of genes from both parents to both children
20#define FB_XOVER_COUNT   2 ///<Count of crossing over types
21//@}
22
23class Geno_fB : public GenoOperators
24{
25private:
26        bool hasStick(SString genotype);
27
28public:
29        double mutationprobs[FB_MUT_COUNT];
30        double crossoverprobs[FB_XOVER_COUNT];
31
32        Geno_fB();
33
34        int checkValidity(const char *geno, const char *genoname);
35
36        int validate(char *&geno, const char *genoname);
37
38        int mutate(char *&geno, float& chg, int &method);
39
40        int crossOver(char *&g1, char *&g2, float& chg1, float& chg2);
41
42        virtual const char* getSimplest() { return "5\naaazz"; }
43
44        uint32_t style(const char *geno, int pos);
45};
46
47#endif //_FB_OPER_H_
Note: See TracBrowser for help on using the repository browser.