diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/transport/gnunet-service-transport_ats.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/transport/gnunet-service-transport_ats.c')
-rw-r--r-- | src/transport/gnunet-service-transport_ats.c | 176 |
1 files changed, 79 insertions, 97 deletions
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index 34d1791b9..2e859f1db 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c | |||
@@ -317,8 +317,8 @@ _lp_simplex (glp_prob *P, void *parm) | |||
317 | } | 317 | } |
318 | 318 | ||
319 | static void | 319 | static void |
320 | _lp_load_matrix (glp_prob *P, int ne, const int ia[], | 320 | _lp_load_matrix (glp_prob *P, int ne, const int ia[], const int ja[], |
321 | const int ja[], const double ar[]) | 321 | const double ar[]) |
322 | { | 322 | { |
323 | #if HAVE_LIBGLPK | 323 | #if HAVE_LIBGLPK |
324 | glp_load_matrix (P, ne, ia, ja, ar); | 324 | glp_load_matrix (P, ne, ia, ja, ar); |
@@ -510,13 +510,8 @@ _dummy2 () | |||
510 | */ | 510 | */ |
511 | 511 | ||
512 | struct ATS_Handle * | 512 | struct ATS_Handle * |
513 | ats_init (double D, | 513 | ats_init (double D, double U, double R, int v_b_min, int v_n_min, |
514 | double U, | 514 | int max_iterations, struct GNUNET_TIME_Relative max_duration, |
515 | double R, | ||
516 | int v_b_min, | ||
517 | int v_n_min, | ||
518 | int max_iterations, | ||
519 | struct GNUNET_TIME_Relative max_duration, | ||
520 | GNUNET_TRANSPORT_ATS_AddressNotification address_not, | 515 | GNUNET_TRANSPORT_ATS_AddressNotification address_not, |
521 | GNUNET_TRANSPORT_ATS_ResultCallback res_cb) | 516 | GNUNET_TRANSPORT_ATS_ResultCallback res_cb) |
522 | { | 517 | { |
@@ -561,10 +556,9 @@ ats_init (double D, | |||
561 | * @return GNUNET_SYSERR if glpk is not available, number of mechanisms used | 556 | * @return GNUNET_SYSERR if glpk is not available, number of mechanisms used |
562 | */ | 557 | */ |
563 | int | 558 | int |
564 | ats_create_problem (struct ATS_Handle *ats, | 559 | ats_create_problem (struct ATS_Handle *ats, struct ATS_internals *stat, |
565 | struct ATS_internals *stat, | 560 | struct ATS_peer *peers, int c_p, |
566 | struct ATS_peer *peers, | 561 | struct ATS_mechanism *mechanisms, int c_m) |
567 | int c_p, struct ATS_mechanism *mechanisms, int c_m) | ||
568 | { | 562 | { |
569 | if ((c_p == 0) || (c_m == 0)) | 563 | if ((c_p == 0) || (c_m == 0)) |
570 | return GNUNET_SYSERR; | 564 | return GNUNET_SYSERR; |
@@ -591,8 +585,9 @@ ats_create_problem (struct ATS_Handle *ats, | |||
591 | c_p, c_m, c_c_ressources, c_q_metrics); | 585 | c_p, c_m, c_c_ressources, c_q_metrics); |
592 | #endif | 586 | #endif |
593 | 587 | ||
594 | int size = 1 + 3 + 10 * c_m + c_p + | 588 | int size = |
595 | (c_q_metrics * c_m) + c_q_metrics + c_c_ressources * c_m; | 589 | 1 + 3 + 10 * c_m + c_p + (c_q_metrics * c_m) + c_q_metrics + |
590 | c_c_ressources * c_m; | ||
596 | int row_index; | 591 | int row_index; |
597 | int array_index = 1; | 592 | int array_index = 1; |
598 | int *ia = GNUNET_malloc (size * sizeof (int)); | 593 | int *ia = GNUNET_malloc (size * sizeof (int)); |
@@ -609,8 +604,8 @@ ats_create_problem (struct ATS_Handle *ats, | |||
609 | /* adding b_t cols */ | 604 | /* adding b_t cols */ |
610 | for (c = 1; c <= c_m; c++) | 605 | for (c = 1; c <= c_m; c++) |
611 | { | 606 | { |
612 | GNUNET_asprintf (&name, | 607 | GNUNET_asprintf (&name, "p_%s_b%i", |
613 | "p_%s_b%i", GNUNET_i2s (&(mechanisms[c].peer->peer)), c); | 608 | GNUNET_i2s (&(mechanisms[c].peer->peer)), c); |
614 | _lp_set_col_name (ats->prob, c, name); | 609 | _lp_set_col_name (ats->prob, c, name); |
615 | GNUNET_free (name); | 610 | GNUNET_free (name); |
616 | _lp_set_col_bnds (ats->prob, c, GLP_LO, 0.0, 0.0); | 611 | _lp_set_col_bnds (ats->prob, c, GLP_LO, 0.0, 0.0); |
@@ -621,9 +616,8 @@ ats_create_problem (struct ATS_Handle *ats, | |||
621 | /* adding n_t cols */ | 616 | /* adding n_t cols */ |
622 | for (c = c_m + 1; c <= 2 * c_m; c++) | 617 | for (c = c_m + 1; c <= 2 * c_m; c++) |
623 | { | 618 | { |
624 | GNUNET_asprintf (&name, | 619 | GNUNET_asprintf (&name, "p_%s_n%i", |
625 | "p_%s_n%i", GNUNET_i2s (&(mechanisms[c - c_m].peer->peer)), | 620 | GNUNET_i2s (&(mechanisms[c - c_m].peer->peer)), (c - c_m)); |
626 | (c - c_m)); | ||
627 | _lp_set_col_name (ats->prob, c, name); | 621 | _lp_set_col_name (ats->prob, c, name); |
628 | GNUNET_free (name); | 622 | GNUNET_free (name); |
629 | _lp_set_col_bnds (ats->prob, c, GLP_DB, 0.0, 1.0); | 623 | _lp_set_col_bnds (ats->prob, c, GLP_DB, 0.0, 1.0); |
@@ -653,8 +647,8 @@ ats_create_problem (struct ATS_Handle *ats, | |||
653 | ar[array_index] = 1; | 647 | ar[array_index] = 1; |
654 | #if VERBOSE_ATS | 648 | #if VERBOSE_ATS |
655 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: [%i,%i]=%f \n", | 649 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: [%i,%i]=%f \n", |
656 | array_index, | 650 | array_index, ia[array_index], ja[array_index], |
657 | ia[array_index], ja[array_index], ar[array_index]); | 651 | ar[array_index]); |
658 | #endif | 652 | #endif |
659 | array_index++; | 653 | array_index++; |
660 | m = m->next; | 654 | m = m->next; |
@@ -754,8 +748,8 @@ ats_create_problem (struct ATS_Handle *ats, | |||
754 | ar[array_index] = value; | 748 | ar[array_index] = value; |
755 | #if VERBOSE_ATS | 749 | #if VERBOSE_ATS |
756 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: [%i,%i]=%f \n", | 750 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: [%i,%i]=%f \n", |
757 | array_index, ia[array_index], | 751 | array_index, ia[array_index], ja[array_index], |
758 | ja[array_index], ar[array_index]); | 752 | ar[array_index]); |
759 | #endif | 753 | #endif |
760 | array_index++; | 754 | array_index++; |
761 | } | 755 | } |
@@ -893,9 +887,8 @@ ats_create_problem (struct ATS_Handle *ats, | |||
893 | ar[array_index] = (mechanisms[c2].peer->f) * value; | 887 | ar[array_index] = (mechanisms[c2].peer->f) * value; |
894 | #if VERBOSE_ATS | 888 | #if VERBOSE_ATS |
895 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: %s [%i,%i]=%f \n", | 889 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: %s [%i,%i]=%f \n", |
896 | array_index, | 890 | array_index, qm[c - 1].name, ia[array_index], ja[array_index], |
897 | qm[c - 1].name, | 891 | ar[array_index]); |
898 | ia[array_index], ja[array_index], ar[array_index]); | ||
899 | #endif | 892 | #endif |
900 | array_index++; | 893 | array_index++; |
901 | } | 894 | } |
@@ -970,8 +963,8 @@ ats_create_problem (struct ATS_Handle *ats, | |||
970 | ar[array_index] = 1 / mechanisms[c].peer->f; | 963 | ar[array_index] = 1 / mechanisms[c].peer->f; |
971 | #if VERBOSE_ATS | 964 | #if VERBOSE_ATS |
972 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: [%i,%i]=%f \n", | 965 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: [%i,%i]=%f \n", |
973 | array_index, | 966 | array_index, ia[array_index], ja[array_index], |
974 | ia[array_index], ja[array_index], ar[array_index]); | 967 | ar[array_index]); |
975 | #endif | 968 | #endif |
976 | array_index++; | 969 | array_index++; |
977 | m = m->next; | 970 | m = m->next; |
@@ -1076,10 +1069,8 @@ ats_modify_problem_state (struct ATS_Handle *ats, enum ATS_problem_state s) | |||
1076 | } | 1069 | } |
1077 | 1070 | ||
1078 | void | 1071 | void |
1079 | ats_solve_problem (struct ATS_Handle *ats, | 1072 | ats_solve_problem (struct ATS_Handle *ats, unsigned int max_it, |
1080 | unsigned int max_it, | 1073 | unsigned int max_dur, unsigned int c_peers, |
1081 | unsigned int max_dur, | ||
1082 | unsigned int c_peers, | ||
1083 | unsigned int c_mechs, struct ATS_internals *stat) | 1074 | unsigned int c_mechs, struct ATS_internals *stat) |
1084 | { | 1075 | { |
1085 | int result = GNUNET_SYSERR; | 1076 | int result = GNUNET_SYSERR; |
@@ -1127,8 +1118,8 @@ ats_solve_problem (struct ATS_Handle *ats, | |||
1127 | lp_solution = _lp_get_status (ats->prob); | 1118 | lp_solution = _lp_get_status (ats->prob); |
1128 | 1119 | ||
1129 | // TODO: Remove if this does not appear until release | 1120 | // TODO: Remove if this does not appear until release |
1130 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "" | 1121 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1131 | "EXECUTED SIMPLEX WITH PRESOLVER! %i \n", lp_solution); | 1122 | "" "EXECUTED SIMPLEX WITH PRESOLVER! %i \n", lp_solution); |
1132 | 1123 | ||
1133 | if (ats_evaluate_results (result, lp_solution, "LP") != GNUNET_YES) | 1124 | if (ats_evaluate_results (result, lp_solution, "LP") != GNUNET_YES) |
1134 | { | 1125 | { |
@@ -1136,10 +1127,8 @@ ats_solve_problem (struct ATS_Handle *ats, | |||
1136 | "After execution simplex with presolver: STILL INVALID!\n"); | 1127 | "After execution simplex with presolver: STILL INVALID!\n"); |
1137 | char *filename; | 1128 | char *filename; |
1138 | 1129 | ||
1139 | GNUNET_asprintf (&filename, | 1130 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i_%llu.mlp", |
1140 | "ats_mlp_p%i_m%i_%llu.mlp", | 1131 | ats->internal.c_peers, ats->internal.c_mechs, |
1141 | ats->internal.c_peers, | ||
1142 | ats->internal.c_mechs, | ||
1143 | GNUNET_TIME_absolute_get ().abs_value); | 1132 | GNUNET_TIME_absolute_get ().abs_value); |
1144 | _lp_write_lp ((void *) ats->prob, NULL, filename); | 1133 | _lp_write_lp ((void *) ats->prob, NULL, filename); |
1145 | GNUNET_free (filename); | 1134 | GNUNET_free (filename); |
@@ -1227,10 +1216,12 @@ ats_update_problem_qm (struct ATS_Handle *ats) | |||
1227 | int c, c2; | 1216 | int c, c2; |
1228 | int c_q_metrics = available_quality_metrics; | 1217 | int c_q_metrics = available_quality_metrics; |
1229 | 1218 | ||
1230 | int *ja = GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | 1219 | int *ja = |
1231 | available_quality_metrics) * sizeof (int)); | 1220 | GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + |
1232 | double *ar = GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | 1221 | available_quality_metrics) * sizeof (int)); |
1233 | available_quality_metrics) * sizeof (double)); | 1222 | double *ar = |
1223 | GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | ||
1224 | available_quality_metrics) * sizeof (double)); | ||
1234 | #if DEBUG_ATS | 1225 | #if DEBUG_ATS |
1235 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Updating problem quality metrics\n"); | 1226 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Updating problem quality metrics\n"); |
1236 | #endif | 1227 | #endif |
@@ -1289,8 +1280,8 @@ ats_update_problem_qm (struct ATS_Handle *ats) | |||
1289 | ar[array_index] = (ats->mechanisms[c2].peer->f) * value; | 1280 | ar[array_index] = (ats->mechanisms[c2].peer->f) * value; |
1290 | #if VERBOSE_ATS | 1281 | #if VERBOSE_ATS |
1291 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: %s [%i,%i]=%f \n", | 1282 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[index]=[%i]: %s [%i,%i]=%f \n", |
1292 | array_index, | 1283 | array_index, qm[c - 1].name, row_index, ja[array_index], |
1293 | qm[c - 1].name, row_index, ja[array_index], ar[array_index]); | 1284 | ar[array_index]); |
1294 | #endif | 1285 | #endif |
1295 | array_index++; | 1286 | array_index++; |
1296 | } | 1287 | } |
@@ -1332,8 +1323,8 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle *ats) | |||
1332 | 1323 | ||
1333 | ats->internal.simplex_rerun_required = GNUNET_NO; | 1324 | ats->internal.simplex_rerun_required = GNUNET_NO; |
1334 | start = GNUNET_TIME_absolute_get (); | 1325 | start = GNUNET_TIME_absolute_get (); |
1335 | if ((ats->internal.recreate_problem == GNUNET_YES) || | 1326 | if ((ats->internal.recreate_problem == GNUNET_YES) || (ats->prob == NULL) || |
1336 | (ats->prob == NULL) || (ats->internal.valid == GNUNET_NO)) | 1327 | (ats->internal.valid == GNUNET_NO)) |
1337 | { | 1328 | { |
1338 | text = "new"; | 1329 | text = "new"; |
1339 | ats->internal.recreate_problem = GNUNET_YES; | 1330 | ats->internal.recreate_problem = GNUNET_YES; |
@@ -1381,10 +1372,8 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle *ats) | |||
1381 | ats->internal.solution = GLP_UNDEF; | 1372 | ats->internal.solution = GLP_UNDEF; |
1382 | if (ats->internal.valid == GNUNET_YES) | 1373 | if (ats->internal.valid == GNUNET_YES) |
1383 | { | 1374 | { |
1384 | ats_solve_problem (ats, | 1375 | ats_solve_problem (ats, ats->max_iterations, |
1385 | ats->max_iterations, | 1376 | ats->max_exec_duration.rel_value, ats->internal.c_peers, |
1386 | ats->max_exec_duration.rel_value, | ||
1387 | ats->internal.c_peers, | ||
1388 | ats->internal.c_mechs, &ats->internal); | 1377 | ats->internal.c_mechs, &ats->internal); |
1389 | } | 1378 | } |
1390 | solving = | 1379 | solving = |
@@ -1402,11 +1391,8 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle *ats) | |||
1402 | #endif | 1391 | #endif |
1403 | GNUNET_log (msg_type, | 1392 | GNUNET_log (msg_type, |
1404 | "MLP %s: creation time: %llu, execution time: %llu, %i peers, %i mechanisms, simplex rerun: %s, solution %s\n", | 1393 | "MLP %s: creation time: %llu, execution time: %llu, %i peers, %i mechanisms, simplex rerun: %s, solution %s\n", |
1405 | text, | 1394 | text, creation.rel_value, solving.rel_value, |
1406 | creation.rel_value, | 1395 | ats->internal.c_peers, ats->internal.c_mechs, |
1407 | solving.rel_value, | ||
1408 | ats->internal.c_peers, | ||
1409 | ats->internal.c_mechs, | ||
1410 | (ats->internal.simplex_rerun_required == | 1396 | (ats->internal.simplex_rerun_required == |
1411 | GNUNET_NO) ? "NO" : "YES", | 1397 | GNUNET_NO) ? "NO" : "YES", |
1412 | (ats->internal.solution == 5) ? "OPTIMAL" : "INVALID"); | 1398 | (ats->internal.solution == 5) ? "OPTIMAL" : "INVALID"); |
@@ -1449,9 +1435,8 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle *ats) | |||
1449 | } | 1435 | } |
1450 | } | 1436 | } |
1451 | 1437 | ||
1452 | GNUNET_STATISTICS_set (ats->stats, | 1438 | GNUNET_STATISTICS_set (ats->stats, "ATS duration", |
1453 | "ATS duration", solving.rel_value + creation.rel_value, | 1439 | solving.rel_value + creation.rel_value, GNUNET_NO); |
1454 | GNUNET_NO); | ||
1455 | GNUNET_STATISTICS_set (ats->stats, "ATS mechanisms", ats->internal.c_mechs, | 1440 | GNUNET_STATISTICS_set (ats->stats, "ATS mechanisms", ats->internal.c_mechs, |
1456 | GNUNET_NO); | 1441 | GNUNET_NO); |
1457 | GNUNET_STATISTICS_set (ats->stats, "ATS peers", ats->internal.c_peers, | 1442 | GNUNET_STATISTICS_set (ats->stats, "ATS peers", ats->internal.c_peers, |
@@ -1470,15 +1455,14 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle *ats) | |||
1470 | if (ats->dump_overwrite == GNUNET_NO) | 1455 | if (ats->dump_overwrite == GNUNET_NO) |
1471 | { | 1456 | { |
1472 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i_%s_%llu.mlp", | 1457 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i_%s_%llu.mlp", |
1473 | ats->internal.c_peers, | 1458 | ats->internal.c_peers, ats->internal.c_mechs, text, |
1474 | ats->internal.c_mechs, | 1459 | GNUNET_TIME_absolute_get ().abs_value); |
1475 | text, GNUNET_TIME_absolute_get ().abs_value); | ||
1476 | _lp_write_lp ((void *) ats->prob, NULL, filename); | 1460 | _lp_write_lp ((void *) ats->prob, NULL, filename); |
1477 | } | 1461 | } |
1478 | else | 1462 | else |
1479 | { | 1463 | { |
1480 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i.mlp", | 1464 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i.mlp", ats->internal.c_peers, |
1481 | ats->internal.c_peers, ats->internal.c_mechs); | 1465 | ats->internal.c_mechs); |
1482 | _lp_write_lp ((void *) ats->prob, NULL, filename); | 1466 | _lp_write_lp ((void *) ats->prob, NULL, filename); |
1483 | } | 1467 | } |
1484 | GNUNET_free (filename); | 1468 | GNUNET_free (filename); |
@@ -1492,15 +1476,14 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle *ats) | |||
1492 | if (ats->dump_overwrite == GNUNET_NO) | 1476 | if (ats->dump_overwrite == GNUNET_NO) |
1493 | { | 1477 | { |
1494 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i_%s_%llu.sol", | 1478 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i_%s_%llu.sol", |
1495 | ats->internal.c_peers, | 1479 | ats->internal.c_peers, ats->internal.c_mechs, text, |
1496 | ats->internal.c_mechs, | 1480 | GNUNET_TIME_absolute_get ().abs_value); |
1497 | text, GNUNET_TIME_absolute_get ().abs_value); | ||
1498 | _lp_print_sol (ats->prob, filename); | 1481 | _lp_print_sol (ats->prob, filename); |
1499 | } | 1482 | } |
1500 | else | 1483 | else |
1501 | { | 1484 | { |
1502 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i.sol", | 1485 | GNUNET_asprintf (&filename, "ats_mlp_p%i_m%i.sol", ats->internal.c_peers, |
1503 | ats->internal.c_peers, ats->internal.c_mechs); | 1486 | ats->internal.c_mechs); |
1504 | _lp_print_sol (ats->prob, filename); | 1487 | _lp_print_sol (ats->prob, filename); |
1505 | } | 1488 | } |
1506 | GNUNET_free (filename); | 1489 | GNUNET_free (filename); |
@@ -1545,8 +1528,8 @@ ats_evaluate_results (int result, int solution, char *problem) | |||
1545 | break; | 1528 | break; |
1546 | case GLP_EITLIM: /* iteration limit exceeded */ | 1529 | case GLP_EITLIM: /* iteration limit exceeded */ |
1547 | #if DEBUG_ATS || VERBOSE_ATS | 1530 | #if DEBUG_ATS || VERBOSE_ATS |
1548 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1531 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s Iteration limit exceeded\n", |
1549 | "%s Iteration limit exceeded\n", problem); | 1532 | problem); |
1550 | #endif | 1533 | #endif |
1551 | break; | 1534 | break; |
1552 | case GLP_ETMLIM: /* time limit exceeded */ | 1535 | case GLP_ETMLIM: /* time limit exceeded */ |
@@ -1602,8 +1585,8 @@ ats_evaluate_results (int result, int solution, char *problem) | |||
1602 | break; | 1585 | break; |
1603 | case GLP_NOFEAS: | 1586 | case GLP_NOFEAS: |
1604 | #if DEBUG_ATS || VERBOSE_ATS | 1587 | #if DEBUG_ATS || VERBOSE_ATS |
1605 | GNUNET_log (error_kind, "%s problem has no %sfeasible solution\n", | 1588 | GNUNET_log (error_kind, "%s problem has no %sfeasible solution\n", problem, |
1606 | problem, (0 == strcmp (problem, "LP") ? "" : "integer ")); | 1589 | (0 == strcmp (problem, "LP") ? "" : "integer ")); |
1607 | #endif | 1590 | #endif |
1608 | break; | 1591 | break; |
1609 | case GLP_INFEAS: | 1592 | case GLP_INFEAS: |
@@ -1629,10 +1612,12 @@ ats_update_problem_cr (struct ATS_Handle *ats) | |||
1629 | int c, c2; | 1612 | int c, c2; |
1630 | double ct_max, ct_min; | 1613 | double ct_max, ct_min; |
1631 | 1614 | ||
1632 | int *ja = GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | 1615 | int *ja = |
1633 | available_quality_metrics) * sizeof (int)); | 1616 | GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + |
1634 | double *ar = GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | 1617 | available_quality_metrics) * sizeof (int)); |
1635 | available_quality_metrics) * sizeof (double)); | 1618 | double *ar = |
1619 | GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | ||
1620 | available_quality_metrics) * sizeof (double)); | ||
1636 | 1621 | ||
1637 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Updating problem quality metrics\n"); | 1622 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Updating problem quality metrics\n"); |
1638 | row_index = ats->internal.begin_cr; | 1623 | row_index = ats->internal.begin_cr; |
@@ -1685,23 +1670,19 @@ ats_set_logging_options (struct ATS_Handle *ats, | |||
1685 | 1670 | ||
1686 | if (ats == NULL) | 1671 | if (ats == NULL) |
1687 | return; | 1672 | return; |
1688 | log_problem = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 1673 | log_problem = |
1689 | "transport", "DUMP_MLP"); | 1674 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport", "DUMP_MLP"); |
1690 | log_solution = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 1675 | log_solution = |
1691 | "transport", | 1676 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport", "DUMP_SOLUTION"); |
1692 | "DUMP_SOLUTION"); | 1677 | overwrite_dump = |
1693 | overwrite_dump = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 1678 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport", "DUMP_OVERWRITE"); |
1694 | "transport", | ||
1695 | "DUMP_OVERWRITE"); | ||
1696 | if (GNUNET_OK == | 1679 | if (GNUNET_OK == |
1697 | GNUNET_CONFIGURATION_get_value_number (cfg, | 1680 | GNUNET_CONFIGURATION_get_value_number (cfg, "transport", "DUMP_MIN_PEERS", |
1698 | "transport", | 1681 | &value)) |
1699 | "DUMP_MIN_PEERS", &value)) | ||
1700 | minimum_peers = (int) value; | 1682 | minimum_peers = (int) value; |
1701 | if (GNUNET_OK == | 1683 | if (GNUNET_OK == |
1702 | GNUNET_CONFIGURATION_get_value_number (cfg, | 1684 | GNUNET_CONFIGURATION_get_value_number (cfg, "transport", "DUMP_MIN_ADDRS", |
1703 | "transport", | 1685 | &value)) |
1704 | "DUMP_MIN_ADDRS", &value)) | ||
1705 | minimum_addresses = (int) value; | 1686 | minimum_addresses = (int) value; |
1706 | 1687 | ||
1707 | 1688 | ||
@@ -1725,10 +1706,12 @@ ats_update_problem_qm_TEST () | |||
1725 | int old_ja[ats->internal.c_mechs + 2]; | 1706 | int old_ja[ats->internal.c_mechs + 2]; |
1726 | double old_ar[ats->internal.c_mechs + 2]; | 1707 | double old_ar[ats->internal.c_mechs + 2]; |
1727 | 1708 | ||
1728 | int *ja = GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | 1709 | int *ja = |
1729 | available_quality_metrics) * sizeof (int)); | 1710 | GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + |
1730 | double *ar = GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | 1711 | available_quality_metrics) * sizeof (int)); |
1731 | available_quality_metrics) * sizeof (double)); | 1712 | double *ar = |
1713 | GNUNET_malloc ((1 + ats->internal.c_mechs * 2 + 3 + | ||
1714 | available_quality_metrics) * sizeof (double)); | ||
1732 | #if DEBUG_ATS | 1715 | #if DEBUG_ATS |
1733 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1716 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1734 | "Updating problem quality metrics TEST\n"); | 1717 | "Updating problem quality metrics TEST\n"); |
@@ -1753,8 +1736,7 @@ ats_update_problem_qm_TEST () | |||
1753 | ar[c2] = old_ar[c2]; | 1736 | ar[c2] = old_ar[c2]; |
1754 | #if VERBOSE_ATS | 1737 | #if VERBOSE_ATS |
1755 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1738 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1756 | "[index]=[%i]: old [%i,%i]=%f new [%i,%i]=%f\n", | 1739 | "[index]=[%i]: old [%i,%i]=%f new [%i,%i]=%f\n", c2, |
1757 | c2, | ||
1758 | row_index, old_ja[c2], old_ar[c2], row_index, ja[c2], ar[c2]); | 1740 | row_index, old_ja[c2], old_ar[c2], row_index, ja[c2], ar[c2]); |
1759 | #endif | 1741 | #endif |
1760 | } | 1742 | } |