| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : pars_awars.h // |
|---|
| 4 | // Purpose : declares AWARs used in PARSIMONY // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in January 2015 // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #ifndef PARS_AWARS_H |
|---|
| 12 | #define PARS_AWARS_H |
|---|
| 13 | |
|---|
| 14 | #ifndef ARBDB_BASE_H |
|---|
| 15 | #include <arbdb_base.h> |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | #define PREFIX_OPTI "optimize/" |
|---|
| 19 | #define PREFIX_KL "kernlin/" |
|---|
| 20 | #define PREFIX_KL_STATIC PREFIX_KL "static/" |
|---|
| 21 | #define PREFIX_KL_DYNAMIC PREFIX_KL "dynamic/" |
|---|
| 22 | #define PREFIX_RAND "randomize/" |
|---|
| 23 | |
|---|
| 24 | #define AWAR_OPTI_MARKED_ONLY PREFIX_OPTI "marked" |
|---|
| 25 | #define AWAR_OPTI_SKIP_FOLDED PREFIX_OPTI "visible" |
|---|
| 26 | |
|---|
| 27 | #define AWAR_RAND_REPEAT "tmp/" PREFIX_RAND "repeat" |
|---|
| 28 | #define AWAR_RAND_PERCENT PREFIX_RAND "percent" |
|---|
| 29 | |
|---|
| 30 | #define AWAR_KL_MAXDEPTH PREFIX_KL "maxdepth" |
|---|
| 31 | #define AWAR_KL_INCDEPTH PREFIX_KL "inc_depth" |
|---|
| 32 | |
|---|
| 33 | #define AWAR_KL_STATIC_ENABLED PREFIX_KL_STATIC "enable" |
|---|
| 34 | #define AWAR_KL_STATIC_DEPTH1 PREFIX_KL_STATIC "depth1" |
|---|
| 35 | #define AWAR_KL_STATIC_DEPTH2 PREFIX_KL_STATIC "depth2" |
|---|
| 36 | #define AWAR_KL_STATIC_DEPTH3 PREFIX_KL_STATIC "depth3" |
|---|
| 37 | #define AWAR_KL_STATIC_DEPTH4 PREFIX_KL_STATIC "depth4" |
|---|
| 38 | #define AWAR_KL_STATIC_DEPTH5 PREFIX_KL_STATIC "depth5" |
|---|
| 39 | |
|---|
| 40 | #define AWAR_KL_DYNAMIC_ENABLED PREFIX_KL_DYNAMIC "enable" |
|---|
| 41 | #define AWAR_KL_DYNAMIC_START PREFIX_KL_DYNAMIC "start" |
|---|
| 42 | #define AWAR_KL_DYNAMIC_MAXX PREFIX_KL_DYNAMIC "maxx" |
|---|
| 43 | #define AWAR_KL_DYNAMIC_MAXY PREFIX_KL_DYNAMIC "maxy" |
|---|
| 44 | |
|---|
| 45 | #define AWAR_KL_FUNCTION_TYPE PREFIX_KL "function_type" // threshold function for dynamic reduction (not configurable; experimental?) |
|---|
| 46 | |
|---|
| 47 | // -------------------------------------------------------------------------------- |
|---|
| 48 | |
|---|
| 49 | const int CUSTOM_STATIC_PATH_REDUCTION_DEPTH = 5; |
|---|
| 50 | const int CUSTOM_DEPTHS = CUSTOM_STATIC_PATH_REDUCTION_DEPTH+1; // (+depth[0], which is always 2) |
|---|
| 51 | |
|---|
| 52 | enum KL_DYNAMIC_THRESHOLD_TYPE { |
|---|
| 53 | AP_QUADRAT_START = 5, |
|---|
| 54 | AP_QUADRAT_MAX = 6 |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | enum EdgeSpec { |
|---|
| 58 | // bit-values: |
|---|
| 59 | ANY_EDGE = 0, // default=0 = take any_edge |
|---|
| 60 | SKIP_UNMARKED_EDGES = 1, |
|---|
| 61 | SKIP_FOLDED_EDGES = 2, // Note: also skips edges adjacent to folded groups |
|---|
| 62 | SKIP_LEAF_EDGES = 4, |
|---|
| 63 | SKIP_INNER_EDGES = 8, |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | struct KL_Settings { |
|---|
| 67 | int maxdepth; // AWAR_KL_MAXDEPTH |
|---|
| 68 | int incdepth; // AWAR_KL_INCDEPTH |
|---|
| 69 | |
|---|
| 70 | struct { |
|---|
| 71 | bool enabled; // AWAR_KL_STATIC_ENABLED |
|---|
| 72 | int depth[CUSTOM_DEPTHS]; // [0]=2, [1..5]=AWAR_KL_STATIC_DEPTH1 .. AWAR_KL_STATIC_DEPTH5 |
|---|
| 73 | } Static; |
|---|
| 74 | struct { |
|---|
| 75 | bool enabled; // AWAR_KL_DYNAMIC_ENABLED |
|---|
| 76 | KL_DYNAMIC_THRESHOLD_TYPE type; // AWAR_KL_FUNCTION_TYPE |
|---|
| 77 | int start; // AWAR_KL_DYNAMIC_START |
|---|
| 78 | int maxx; // AWAR_KL_DYNAMIC_MAXX |
|---|
| 79 | int maxy; // AWAR_KL_DYNAMIC_MAXY |
|---|
| 80 | } Dynamic; |
|---|
| 81 | |
|---|
| 82 | EdgeSpec whichEdges; |
|---|
| 83 | |
|---|
| 84 | KL_Settings(AW_root *aw_root); // read from AWARs |
|---|
| 85 | #if defined(UNIT_TESTS) |
|---|
| 86 | explicit KL_Settings(); // init with unittest defaults |
|---|
| 87 | #endif |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | #else |
|---|
| 92 | #error pars_awars.h included twice |
|---|
| 93 | #endif // PARS_AWARS_H |
|---|
| 94 | |
|---|