14 # define IF_EPOCHS(epochs, max_epochs)((max_epochs) < 0 ? true : (epochs) < (max_epochs))
15 # define ABS(x)((x) < 0 ? -(x) : (x))
17 # define DEF_POOL_SIZE (unsigned int)4
18 # define DEF_MUT_RATE (double)0.1
19 # define DEF_SEL_RATE (double)0.9
20 # define DEF_MAX_EPOCHS (int)-1
21 # define DEF_EXPEC_FIT (double)100
22 # define DEF_NUM_THREAD (unsigned int)2
23 # define DEF_INT_REPORT (unsigned int)1
24 # define DEF_MIN_SIZE (unsigned int)2
26 # define ERR_POP_SIZE (const char *)"Error: Population::setSize: invalid size of population."
27 # define ERR_POP_PSIZE (const char *)"Error: Population::setPoolSize: invalid pool size."
28 # define ERR_POP_MUT (const char *)"Error: Population::setMutationRate: invalid mutation rate."
29 # define ERR_POP_SELT (const char *)"Error: Population::setSelectionRate: invalid selection rate."
30 # define ERR_POP_GEN (const char *)"Error: Population::Generate: allocation fail."
31 # define ERR_POP_EVAL (const char *)"Error: Population::Evaluate: allocation fail."
32 # define ERR_POP_CROSS (const char *)"Error: Population::Crossover: allocation fail."
34 # define ERR_GA_POPSIZE (const char *)"Error: GAEngine: Invalid population size"
35 # define ERR_GA_POOSIZE (const char *)"Error: GAEngine: Invalid pool size"
36 # define ERR_GA_MUTR (const char *)"Error: GAEngine: Invalid mutation rate"
37 # define ERR_GA_SELR (const char *)"Error: GAEngine: Invalid selection rate"
38 # define ERR_GA_GENERAT (const char *)"Error: GAEngine: No DNA Generator defined"
39 # define ERR_GA_FFIT (const char *)"Error: GAEngine: No DNA Fitness Function defined"
40 # define ERR_GA_FCOMP (const char *)"Error: GAEngine: No DNA Compare Function defined"
41 # define ERR_GA_FMUT (const char *)"Error: GAEngine: No DNA Mutation Function defined"
42 # define ERR_GA_FCROSS (const char *)"Error: GAEngine: No DNA Crossover Function defined"
43 # define ERR_GA_NOCONF (const char *)"Error: GAEngine: No config is provided !"
45 # define STR_POP_SIZE (const char *)"Population size: "
46 # define STR_POP_MUT (const char *)"Mutation rate: "
47 # define STR_POP_SELT (const char *)"Selection rate: "
48 # define STR_POP_BFIT (const char *)"Best fitness: "
49 # define STR_POP_AFIT (const char *)"Average fitness: "
50 # define STR_POP_GENES (const char *)"Best individual: "
52 # define STR_GA_EPOCHS (const char *)"Epochs: "