Changeset 7
- Timestamp:
- 05/22/09 21:56:05 (16 years ago)
- Location:
- cpp/f8-to-f1
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/f8-to-f1/conv_f8tof1.cpp
r1 r7 601 601 int position = firstProduction->parameters.getParameterPosition(stringToSString(iter->first)); 602 602 //cout << "position of " << iter->first << ": " << position << endl; 603 //params.insert(params.begin() + (position - 1), iter->second);604 params[position - 1] = iter->second;603 params.insert(params.begin() + (position - 1), iter->second); 604 //params[position - 1] = iter->second; 605 605 } 606 606 … … 646 646 if (a != NULL) { 647 647 dst += a->getF1Genotype(p); 648 if (dst.len() > 1500) { 649 return ""; //genotype becomes too long so we abort conversion 650 } 648 651 } 649 652 } -
cpp/f8-to-f1/conv_f8tof1_grammar.c
r1 r7 135 135 */ 136 136 static const YYACTIONTYPE yy_action[] = { 137 /* 0 */ 4 0, 4, 23, 24, 25, 26, 27, 28, 64, 67,138 /* 10 */ 31, 71, 44, 55, 4, 41, 34, 82, 75, 64,139 /* 20 */ 6 5, 68, 70, 31, 65, 44, 84, 4, 41, 34,140 /* 30 */ 8 2, 75, 64, 65, 68, 70, 69, 65, 44, 20,141 /* 40 */ 60, 4, 61, 56, 4, 47, 8, 68, 70, 46,142 /* 50 */ 69, 32, 44, 69, 49, 44, 59, 57, 4, 47,143 /* 60 */ 42, 68, 70, 85, 68, 70, 38, 69, 76, 44,144 /* 70 */ 1 0, 45, 39, 77, 58, 15, 14, 5, 68, 70,145 /* 80 */ 65, 71, 72, 73, 12, 13, 15, 14, 60, 9,146 /* 90 */ 61, 91, 78, 6, 60, 48, 61, 53, 1, 33,147 /* 100 */ 35, 10, 45, 39, 79, 33, 66, 80, 12, 13,148 /* 110 */ 15, 14, 139, 16, 60, 60, 61, 61, 52, 60,149 /* 120 */ 6 0, 61, 61, 81, 17, 36, 37, 54, 22, 51,150 /* 130 */ 62, 63, 30, 18, 50, 3, 2, 43, 74, 11,151 /* 140 */ 75, 88, 7, 19, 21, 83, 18, 50, 86, 29,152 /* 150 */ 87, 89, 90,137 /* 0 */ 46, 4, 23, 24, 26, 27, 22, 28, 85, 61, 138 /* 10 */ 31, 62, 43, 56, 4, 40, 37, 83, 76, 66, 139 /* 20 */ 63, 69, 71, 31, 72, 43, 9, 4, 40, 37, 140 /* 30 */ 83, 76, 47, 4, 69, 71, 70, 14, 43, 139, 141 /* 40 */ 17, 4, 70, 59, 43, 51, 66, 69, 71, 57, 142 /* 50 */ 70, 52, 43, 69, 71, 38, 4, 58, 15, 11, 143 /* 60 */ 84, 69, 71, 19, 61, 70, 62, 43, 12, 13, 144 /* 70 */ 15, 11, 44, 89, 30, 34, 69, 71, 16, 48, 145 /* 80 */ 75, 5, 76, 91, 66, 72, 73, 74, 12, 13, 146 /* 90 */ 15, 11, 61, 20, 62, 65, 66, 6, 1, 2, 147 /* 100 */ 65, 7, 42, 33, 35, 54, 10, 39, 41, 10, 148 /* 110 */ 39, 41, 61, 49, 62, 68, 61, 61, 62, 62, 149 /* 120 */ 61, 88, 62, 33, 67, 65, 66, 36, 32, 25, 150 /* 130 */ 8, 64, 52, 18, 16, 48, 86, 55, 29, 53, 151 /* 140 */ 60, 87, 90, 81, 3, 77, 78, 45, 21, 79, 152 /* 150 */ 140, 140, 80, 82, 50, 153 153 }; 154 154 static const YYCODETYPE yy_lookahead[] = { 155 /* 0 */ 27, 28, 13, 14, 15, 16, 17, 18, 21, 11,156 /* 10 */ 37, 23, 39, 27, 28, 42, 43, 44, 45, 21,157 /* 20 */ 22, 48, 49, 37, 22, 39, 11, 28, 42, 43,158 /* 30 */ 44, 45, 21, 22, 48, 49, 37, 22, 39, 32,159 /* 40 */ 3 5, 28, 37, 44, 28, 37, 1, 48, 49, 41,160 /* 50 */ 37, 46, 39, 37, 7, 39, 11, 44, 28, 37,161 /* 60 */ 44, 48, 49, 41, 48, 49, 34, 37, 35, 39,162 /* 70 */ 38, 39, 40, 35, 44, 4, 5, 19, 48, 49,163 /* 80 */ 22, 23, 24, 25, 2, 3, 4, 5, 35, 33,164 /* 90 */ 37, 0, 35, 11, 35, 39, 37, 34, 9, 46,165 /* 100 */ 47, 38, 39, 40, 35, 46, 47, 35, 2, 3,166 /* 110 */ 4, 5, 29, 30, 35, 35, 37, 37, 35, 35,167 /* 120 */ 35, 37, 37, 35, 1, 46, 46, 6, 31, 35,168 /* 130 */ 46, 46, 37, 36, 37, 12, 9, 20, 43, 10,169 /* 140 */ 45, 31, 10, 10, 1, 11, 36, 37, 6, 8,170 /* 150 */ 6, 6, 6,155 /* 0 */ 27, 28, 13, 14, 15, 16, 17, 18, 11, 35, 156 /* 10 */ 37, 37, 39, 27, 28, 42, 43, 44, 45, 22, 157 /* 20 */ 46, 48, 49, 37, 23, 39, 33, 28, 42, 43, 158 /* 30 */ 44, 45, 39, 28, 48, 49, 37, 10, 39, 29, 159 /* 40 */ 30, 28, 37, 44, 39, 35, 22, 48, 49, 44, 160 /* 50 */ 37, 37, 39, 48, 49, 41, 28, 44, 4, 5, 161 /* 60 */ 11, 48, 49, 10, 35, 37, 37, 39, 2, 3, 162 /* 70 */ 4, 5, 44, 31, 37, 46, 48, 49, 36, 37, 163 /* 80 */ 43, 19, 45, 0, 22, 23, 24, 25, 2, 3, 164 /* 90 */ 4, 5, 35, 1, 37, 21, 22, 11, 9, 9, 165 /* 100 */ 21, 10, 34, 46, 47, 34, 38, 39, 40, 38, 166 /* 110 */ 39, 40, 35, 20, 37, 11, 35, 35, 37, 37, 167 /* 120 */ 35, 6, 37, 46, 47, 21, 22, 46, 46, 31, 168 /* 130 */ 1, 46, 37, 1, 36, 37, 41, 6, 8, 6, 169 /* 140 */ 11, 6, 6, 35, 12, 35, 35, 7, 32, 35, 170 /* 150 */ 50, 50, 35, 35, 35, 171 171 }; 172 #define YY_SHIFT_USE_DFLT (-1 4)172 #define YY_SHIFT_USE_DFLT (-12) 173 173 #define YY_SHIFT_MAX 52 174 174 static const short yy_shift_ofst[] = { 175 /* 0 */ -13, 58, 58, 58, 58, 58, 58, -2, 11, -12,176 /* 10 */ -12, 11, 11, 11, 11, 11, 2, 2, 2, 15,177 /* 20 */ -12, 2, 47, -13, -13, -13, -13, -13, -13, -13,178 /* 30 */ -11, -11, 8 2, 106, 123, 45, 71, 71, 91, 89,179 /* 40 */ 121, 127, 117, 129, 132, 133, 134, 143, 142, 144,180 /* 50 */ 1 41, 145, 146,175 /* 0 */ 79, 62, 62, 62, 62, 62, 62, 104, 74, 1, 176 /* 10 */ 1, 74, 74, 74, 74, 74, 24, 24, 24, -3, 177 /* 20 */ 24, 1, 79, 79, 79, 140, 79, 79, 79, 79, 178 /* 30 */ -11, -11, 86, 66, 54, 129, 54, 132, 49, 53, 179 /* 40 */ 89, 90, 83, 91, 93, 115, 131, 135, 130, 27, 180 /* 50 */ 136, 133, 92, 181 181 }; 182 182 #define YY_REDUCE_USE_DFLT (-28) 183 183 #define YY_REDUCE_MAX 29 184 184 static const signed char yy_reduce_ofst[] = { 185 /* 0 */ 83, -27, -14, -1, 13, 16, 30, 53, 59, 32,186 /* 10 */ 63, 5, 79, 80, 84, 85, 97, 95, 110, 8,187 /* 20 */ 56, 22, 7, 33, 38, 57, 69, 72, 88, 94,185 /* 0 */ 10, -14, -27, 5, 13, 28, -1, 57, 77, 68, 186 /* 10 */ 71, -26, 29, 81, 82, 85, 42, 98, 37, 14, 187 /* 20 */ 95, -7, 108, 110, 111, 116, 114, 117, 118, 119, 188 188 }; 189 189 static const YYACTIONTYPE yy_default[] = { 190 190 /* 0 */ 138, 117, 117, 117, 117, 117, 117, 138, 138, 98, 191 /* 10 */ 98, 138, 138, 138, 138, 138, 95, 138, 95, 138,191 /* 10 */ 98, 138, 138, 138, 138, 138, 95, 95, 138, 138, 192 192 /* 20 */ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 193 /* 30 */ 138, 123, 138, 125, 1 38, 138, 129, 130, 138, 138,194 /* 40 */ 1 38, 106, 138, 138, 138, 138, 138, 104, 138, 138,195 /* 50 */ 138, 138, 1 38, 97, 100, 105, 107, 118, 119, 120,196 /* 60 */ 12 7, 128, 131, 132, 133, 134, 126, 121, 122, 123,197 /* 70 */ 12 4, 135, 136, 137, 109, 110, 111, 112, 113, 114,198 /* 80 */ 11 5, 116, 108, 101, 102, 103, 99, 93, 94, 96,199 /* 90 */ 9 2,193 /* 30 */ 138, 123, 138, 125, 129, 138, 130, 138, 138, 138, 194 /* 40 */ 106, 138, 138, 138, 138, 138, 138, 138, 138, 138, 195 /* 50 */ 138, 138, 104, 92, 97, 100, 105, 107, 118, 119, 196 /* 60 */ 120, 127, 128, 131, 132, 133, 134, 126, 121, 122, 197 /* 70 */ 123, 124, 135, 136, 137, 109, 110, 111, 112, 113, 198 /* 80 */ 114, 115, 116, 108, 101, 102, 103, 99, 93, 94, 199 /* 90 */ 96, 200 200 }; 201 201 #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0])) … … 1184 1184 #endif 1185 1185 } 1186 1187 1186 delete yymsp[-1].minor.yy89.actions; 1188 1187 delete yymsp[-1].minor.yy89.parameters; 1189 1188 } 1190 1189 } 1191 #line 119 3"conv_f8tof1_grammar.c"1190 #line 1192 "conv_f8tof1_grammar.c" 1192 1191 break; 1193 1192 case 28: /* real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN real_prod */ 1194 #line 39 4"conv_f8tof1_grammar.y"1193 #line 393 "conv_f8tof1_grammar.y" 1195 1194 { 1196 1195 if (!syntaxOnly) { … … 1224 1223 } 1225 1224 } 1226 #line 122 8"conv_f8tof1_grammar.c"1225 #line 1227 "conv_f8tof1_grammar.c" 1227 1226 break; 1228 1227 case 29: /* prod_piece ::= prod_name LPAREN multiple_val RPAREN */ 1229 #line 42 6"conv_f8tof1_grammar.y"1228 #line 425 "conv_f8tof1_grammar.y" 1230 1229 { 1231 1230 if (!syntaxOnly) { … … 1245 1244 } 1246 1245 } 1247 #line 124 9"conv_f8tof1_grammar.c"1246 #line 1248 "conv_f8tof1_grammar.c" 1248 1247 break; 1249 1248 case 30: /* prod_piece ::= prod_name LPAREN RPAREN */ 1250 #line 44 3"conv_f8tof1_grammar.y"1249 #line 442 "conv_f8tof1_grammar.y" 1251 1250 { 1252 1251 if (!syntaxOnly) { … … 1257 1256 } 1258 1257 yygotominor.yy89.actions = new vector<Action*>(); 1258 vector<SString> param; 1259 1259 yygotominor.yy89.parameters = new vector<vector<SString> >(); 1260 yygotominor.yy89.parameters->push_back(param); 1260 1261 1261 1262 Production *p = lsys->productions.find(sstringToString(*(yymsp[-2].minor.yy78.strValue)))->second; … … 1264 1265 } 1265 1266 } 1266 #line 126 8"conv_f8tof1_grammar.c"1267 #line 1269 "conv_f8tof1_grammar.c" 1267 1268 break; 1268 1269 case 31: /* prod_piece ::= command */ 1269 #line 45 8"conv_f8tof1_grammar.y"1270 #line 459 "conv_f8tof1_grammar.y" 1270 1271 { 1271 1272 if (!syntaxOnly) { … … 1284 1285 } 1285 1286 } 1286 #line 128 8"conv_f8tof1_grammar.c"1287 #line 1289 "conv_f8tof1_grammar.c" 1287 1288 break; 1288 1289 case 32: /* prod_piece ::= param_name */ 1289 #line 47 4"conv_f8tof1_grammar.y"1290 #line 475 "conv_f8tof1_grammar.y" 1290 1291 { 1291 1292 if (!syntaxOnly) { … … 1305 1306 } 1306 1307 } 1307 #line 13 09"conv_f8tof1_grammar.c"1308 #line 1310 "conv_f8tof1_grammar.c" 1308 1309 break; 1309 1310 case 33: /* prod_piece ::= neuron */ 1310 #line 49 1"conv_f8tof1_grammar.y"1311 #line 492 "conv_f8tof1_grammar.y" 1311 1312 { 1312 1313 if (!syntaxOnly) { … … 1326 1327 } 1327 1328 } 1328 #line 133 0"conv_f8tof1_grammar.c"1329 #line 1331 "conv_f8tof1_grammar.c" 1329 1330 break; 1330 1331 case 34: /* multiple_val ::= single_val */ 1331 #line 5 09"conv_f8tof1_grammar.y"1332 #line 510 "conv_f8tof1_grammar.y" 1332 1333 { 1333 1334 if (!syntaxOnly) { … … 1342 1343 } 1343 1344 } 1344 #line 134 6"conv_f8tof1_grammar.c"1345 #line 1347 "conv_f8tof1_grammar.c" 1345 1346 break; 1346 1347 case 35: /* multiple_val ::= multiple_val COMMA multiple_val */ 1347 #line 52 1"conv_f8tof1_grammar.y"1348 #line 522 "conv_f8tof1_grammar.y" 1348 1349 { 1349 1350 if (!syntaxOnly) { … … 1364 1365 } 1365 1366 } 1366 #line 136 8"conv_f8tof1_grammar.c"1367 #line 1369 "conv_f8tof1_grammar.c" 1367 1368 break; 1368 1369 case 36: /* single_val ::= double_val */ 1369 #line 54 0"conv_f8tof1_grammar.y"1370 #line 541 "conv_f8tof1_grammar.y" 1370 1371 { 1371 1372 if (!syntaxOnly) { … … 1379 1380 } 1380 1381 } 1381 #line 138 3"conv_f8tof1_grammar.c"1382 #line 1384 "conv_f8tof1_grammar.c" 1382 1383 break; 1383 1384 case 37: /* single_val ::= param_name */ 1384 #line 55 1"conv_f8tof1_grammar.y"1385 #line 552 "conv_f8tof1_grammar.y" 1385 1386 { 1386 1387 if (!syntaxOnly) { … … 1394 1395 } 1395 1396 } 1396 #line 139 8"conv_f8tof1_grammar.c"1397 #line 1399 "conv_f8tof1_grammar.c" 1397 1398 break; 1398 1399 case 38: /* single_val ::= single_val PLUS single_val */ 1399 #line 56 2"conv_f8tof1_grammar.y"1400 #line 563 "conv_f8tof1_grammar.y" 1400 1401 { 1401 1402 if (!syntaxOnly) { … … 1410 1411 } 1411 1412 } 1412 #line 141 4"conv_f8tof1_grammar.c"1413 #line 1415 "conv_f8tof1_grammar.c" 1413 1414 break; 1414 1415 case 39: /* single_val ::= single_val MINUS single_val */ 1415 #line 57 4"conv_f8tof1_grammar.y"1416 #line 575 "conv_f8tof1_grammar.y" 1416 1417 { 1417 1418 if (!syntaxOnly) { … … 1426 1427 } 1427 1428 } 1428 #line 143 0"conv_f8tof1_grammar.c"1429 #line 1431 "conv_f8tof1_grammar.c" 1429 1430 break; 1430 1431 case 40: /* single_val ::= single_val TIMES single_val */ 1431 #line 58 6"conv_f8tof1_grammar.y"1432 #line 587 "conv_f8tof1_grammar.y" 1432 1433 { 1433 1434 if (!syntaxOnly) { … … 1442 1443 } 1443 1444 } 1444 #line 144 6"conv_f8tof1_grammar.c"1445 #line 1447 "conv_f8tof1_grammar.c" 1445 1446 break; 1446 1447 case 41: /* single_val ::= single_val DIV single_val */ 1447 #line 59 8"conv_f8tof1_grammar.y"1448 #line 599 "conv_f8tof1_grammar.y" 1448 1449 { 1449 1450 if (!syntaxOnly) { … … 1458 1459 } 1459 1460 } 1460 #line 146 2"conv_f8tof1_grammar.c"1461 #line 1463 "conv_f8tof1_grammar.c" 1461 1462 break; 1462 1463 case 42: /* double_val ::= DOUBLE_VAL */ 1463 #line 61 1"conv_f8tof1_grammar.y"1464 #line 612 "conv_f8tof1_grammar.y" 1464 1465 { 1465 1466 if (!syntaxOnly) { … … 1472 1473 } 1473 1474 } 1474 #line 147 6"conv_f8tof1_grammar.c"1475 #line 1477 "conv_f8tof1_grammar.c" 1475 1476 break; 1476 1477 case 43: /* param_name ::= PARAM_NAME */ 1477 #line 62 1"conv_f8tof1_grammar.y"1478 #line 622 "conv_f8tof1_grammar.y" 1478 1479 { 1479 1480 if (!syntaxOnly) { … … 1486 1487 } 1487 1488 } 1488 #line 149 0"conv_f8tof1_grammar.c"1489 #line 1491 "conv_f8tof1_grammar.c" 1489 1490 break; 1490 1491 case 44: /* prod_name ::= PROD_NAME */ 1491 #line 63 1"conv_f8tof1_grammar.y"1492 #line 632 "conv_f8tof1_grammar.y" 1492 1493 { 1493 1494 if (!syntaxOnly) { … … 1500 1501 } 1501 1502 } 1502 #line 150 4"conv_f8tof1_grammar.c"1503 #line 1505 "conv_f8tof1_grammar.c" 1503 1504 break; 1504 1505 case 45: /* command ::= COMMAND */ 1505 #line 64 1"conv_f8tof1_grammar.y"1506 #line 642 "conv_f8tof1_grammar.y" 1506 1507 { 1507 1508 if (!syntaxOnly) { … … 1514 1515 } 1515 1516 } 1516 #line 151 8"conv_f8tof1_grammar.c"1517 #line 1519 "conv_f8tof1_grammar.c" 1517 1518 break; 1518 1519 case 46: /* neuron ::= NEURON */ 1519 #line 65 1"conv_f8tof1_grammar.y"1520 #line 652 "conv_f8tof1_grammar.y" 1520 1521 { 1521 1522 if (!syntaxOnly) { … … 1528 1529 } 1529 1530 } 1530 #line 153 2"conv_f8tof1_grammar.c"1531 #line 1533 "conv_f8tof1_grammar.c" 1531 1532 break; 1532 1533 }; -
cpp/f8-to-f1/geno_f8.cpp
r6 r7 1199 1199 1200 1200 RelationType Geno_f8::getDifferentCondition(RelationType type) { 1201 RelationType types[5]; 1201 RelationType types[6]; 1202 types[0] = r_greater; 1203 types[1] = r_greaterEqual; 1204 types[2] = r_equal; 1205 types[3] = r_different; 1206 types[4] = r_lessEqual; 1207 types[5] = r_less; 1208 1209 for (int i = 0; i < 6; i++) { 1210 if (types[i] == type) { 1211 types[i] = types[5]; 1212 types[5] = type; 1213 break; 1214 } 1215 } 1216 1202 1217 int randomType = randomN(5); 1203 if (type == r_greater) {1204 types[0] = r_greaterEqual;1205 types[1] = r_equal;1206 types[2] = r_different;1207 types[3] = r_lessEqual;1208 types[4] = r_less;1209 } else if (type == r_greaterEqual) {1210 types[0] = r_greater;1211 types[1] = r_equal;1212 types[2] = r_different;1213 types[3] = r_lessEqual;1214 types[4] = r_less;1215 } else if (type == r_equal) {1216 types[0] = r_greater;1217 types[1] = r_greaterEqual;1218 types[2] = r_different;1219 types[3] = r_lessEqual;1220 types[4] = r_less;1221 } else if (type == r_different) {1222 types[0] = r_greater;1223 types[1] = r_greaterEqual;1224 types[2] = r_equal;1225 types[3] = r_lessEqual;1226 types[4] = r_less;1227 } else if (type == r_lessEqual) {1228 types[0] = r_greater;1229 types[1] = r_greaterEqual;1230 types[2] = r_equal;1231 types[3] = r_different;1232 types[4] = r_less;1233 } else if (type == r_less) {1234 types[0] = r_greater;1235 types[1] = r_greaterEqual;1236 types[2] = r_equal;1237 types[3] = r_different;1238 types[4] = r_lessEqual;1239 }1240 1218 return types[randomType]; 1241 1219 }
Note: See TracChangeset
for help on using the changeset viewer.