Changeset 1000 for cpp/frams/genetics/fS/fS_general.h
- Timestamp:
- 07/13/20 13:53:25 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fS/fS_general.h
r969 r1000 16 16 /** @name Values of constants used in encoding */ 17 17 //@{ 18 #define MODE_SEPARATOR ':' 18 19 #define BRANCH_START '(' 19 20 #define BRANCH_END ')' … … 35 36 RIGHT = 1 36 37 }; 37 38 /** @name Every modifier changes the underlying value by this multiplier */39 const double MODIFIER_MULTIPLIER = 1.1;40 /**41 * Used in finding the proper distance between the parts42 * distance between spheres / sphere radius43 * That default value can be changed in certain cases44 * */45 const float SPHERE_RELATIVE_DISTANCE = 0.25;46 /**47 * Used in finding the proper distance between the parts48 * The maximal allowed value for49 * maximal radius of the node / sphere radius50 */51 const int MAX_DIAMETER_QUOTIENT = 30;52 /**53 * The tolerance of the value of distance between parts54 */55 const double SPHERE_DISTANCE_TOLERANCE = 0.99;56 38 57 39 … … 109 91 const vector<string> PARAMS {INGESTION, FRICTION, ROT_X, ROT_Y, ROT_Z, RX, RY, RZ, SIZE, SIZE_X, SIZE_Y, SIZE_Z, 110 92 STIFFNESS}; 93 const vector<string> SIZE_PARAMS {SIZE, SIZE_X, SIZE_Y, SIZE_Z}; 111 94 112 95 /** @name Default values of node parameters*/ 113 static const Part defPart = Model::getDefPart();114 static const Joint defJoint = Model::getDefJoint();115 96 const std::map<Part::Shape, double> volumeMultipliers = { 116 97 {Part::Shape::SHAPE_CUBOID, 8.0}, … … 118 99 {Part::Shape::SHAPE_ELLIPSOID, (4.0 / 3.0) * M_PI}, 119 100 }; 120 const std::map<string, double> defaultValues = { 121 {INGESTION, defPart.ingest}, 122 {FRICTION, defPart.friction}, 123 {STIFFNESS, defJoint.stif}, 124 {ROT_X, 0.0}, 125 {ROT_Y, 0.0}, 126 {ROT_Z, 0.0}, 127 {RX, 0.0}, 128 {RY, 0.0}, 129 {RZ, 0.0}, 130 {SIZE, 1.0}, 131 {SIZE_X, 1.0}, 132 {SIZE_Y, 1.0}, 133 {SIZE_Z, 1.0} 134 }; 135 136 const std::map<string, double> minValues = { 137 {INGESTION, 0}, 138 {FRICTION, 0}, 139 {STIFFNESS, 0.0}, 140 {ROT_X, -M_PI}, 141 {ROT_Y, -M_PI}, 142 {ROT_Z, -M_PI}, 143 {RX, -M_PI}, 144 {RY, -M_PI}, 145 {RZ, -M_PI}, 146 {SIZE, 0.01}, 147 {SIZE_X, 0.01}, 148 {SIZE_Y, 0.01}, 149 {SIZE_Z, 0.01} 150 }; 151 152 const std::map<string, double> maxValues = { 153 {INGESTION, 1.0}, 154 {FRICTION, 1.0}, 155 {STIFFNESS, 0.0}, 156 {ROT_X, M_PI}, 157 {ROT_Y, M_PI}, 158 {ROT_Z, M_PI}, 159 {RX, M_PI}, 160 {RY, M_PI}, 161 {RZ, M_PI}, 162 {SIZE, 100.0}, 163 {SIZE_X, 100.0}, 164 {SIZE_Y, 100.0}, 165 {SIZE_Z, 100.0} 166 }; 101 102 extern const std::map<string, double> defaultValues; 167 103 168 104 /** @name Number of tries of performing a mutation before GENOPER_FAIL is returned */ … … 318 254 }; 319 255 256 struct GenotypeParams{ 257 double modifierMultiplier; // Every modifier changes the underlying value by this multiplier 258 }; 259 320 260 /** 321 261 * Represents a node in the graph that represents a genotype. … … 334 274 Part *part; /// A part object built from node. Used in building the Model 335 275 int partCodeLen; /// The length of substring that directly describes the corresponding part 336 337 std::map<string, double> params; /// The map of all the node params 276 GenotypeParams genotypeParams; 277 278 338 279 vector<Node *> children; /// Vector of all direct children 339 280 std::map<char, int> modifiers; /// Vector of all modifiers … … 432 373 Part::Shape partType; /// The type of the part 433 374 State *state = nullptr; /// The phenotypic state that inherits from ancestors 434 435 Node(Substring &genotype, Node *parent); 375 std::map<string, double> params; /// The map of all the node params 376 377 Node(Substring &genotype, Node *parent, GenotypeParams genotypeParams); 436 378 437 379 ~Node(); … … 463 405 * @return True if the parameter value was change, false otherwise 464 406 */ 465 bool changeSizeParam(string paramKey, bool ensureCircleSection);407 bool mutateSizeParam(string paramKey, bool ensureCircleSection); 466 408 467 409 /**
Note: See TracChangeset
for help on using the changeset viewer.