diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-04 12:31:42 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-04 12:31:42 +0000 |
commit | 0151f4b4c92002f7f3e712d1d0bce3d7b2077312 (patch) | |
tree | 3cb411c6aea3a6198a366465d1c02d005c88deee /src/ats | |
parent | 97290b21585defdb0ff86c67029eb995dac6565b (diff) | |
download | gnunet-0151f4b4c92002f7f3e712d1d0bce3d7b2077312.tar.gz gnunet-0151f4b4c92002f7f3e712d1d0bce3d7b2077312.zip |
multiple fixes:
- read cfg option to dump problem and solution
- do not resolve if no requests or addresses
- fixed address deletion
- implemented function to update single value
- fixed preference changes
- preference changes now use normalized values
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_mlp.c | 125 |
1 files changed, 84 insertions, 41 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c index 12687eac4..1e2237eee 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.c +++ b/src/ats/gnunet-service-ats-solver_mlp.c | |||
@@ -237,7 +237,7 @@ mlp_delete_problem (struct GAS_MLP_Handle *mlp) | |||
237 | mlp->p.ci = MLP_UNDEFINED; | 237 | mlp->p.ci = MLP_UNDEFINED; |
238 | 238 | ||
239 | 239 | ||
240 | GNUNET_CONTAINER_multihashmap_iterate (mlp->peers, &reset_peers, NULL); | 240 | GNUNET_CONTAINER_multihashmap_iterate (mlp->requested_peers, &reset_peers, NULL); |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
@@ -441,32 +441,49 @@ mlp_create_problem_update_value (struct MLP_Problem *p, | |||
441 | if (0 >= c_cols) | 441 | if (0 >= c_cols) |
442 | return; | 442 | return; |
443 | 443 | ||
444 | val_array = GNUNET_malloc (c_cols * sizeof (double)); | 444 | val_array = GNUNET_malloc ((c_cols +1)* sizeof (double)); |
445 | GNUNET_assert (NULL != val_array); | 445 | GNUNET_assert (NULL != val_array); |
446 | ind_array = GNUNET_malloc (c_cols * sizeof (int)); | 446 | ind_array = GNUNET_malloc ((c_cols+1) * sizeof (int)); |
447 | GNUNET_assert (NULL != ind_array); | 447 | GNUNET_assert (NULL != ind_array); |
448 | /* Extract the row */ | 448 | /* Extract the row */ |
449 | 449 | ||
450 | if (0 == (c_elems = glp_get_mat_row (p->prob, row, ind_array, val_array))) | 450 | if (0 == (c_elems = glp_get_mat_row (p->prob, row, ind_array, val_array))) |
451 | { | ||
452 | GNUNET_free (ind_array); | ||
453 | GNUNET_free (val_array); | ||
451 | return; | 454 | return; |
455 | } | ||
452 | 456 | ||
453 | /* Update the value */ | 457 | /* Update the value */ |
454 | for (c1 = 0; c1 <= c_elems; c1++) | 458 | for (c1 = 1; c1 < (c_elems+1); c1++) |
455 | { | 459 | { |
456 | if (ind_array[c1] == row) | 460 | /* Debug |
461 | fprintf (stderr, "cur %u of %u: [%u] %s <-> [%u] %s\n", | ||
462 | c1, c_elems, | ||
463 | ind_array[c1], | ||
464 | glp_get_col_name(p->prob, ind_array[c1]), | ||
465 | col, | ||
466 | glp_get_col_name(p->prob, col) | ||
467 | ); | ||
468 | */ | ||
469 | if (ind_array[c1] == col) | ||
457 | break; | 470 | break; |
458 | } | 471 | } |
459 | if (c_elems == c1) | 472 | if ((c_elems + 1)== c1) |
473 | { | ||
474 | GNUNET_free (ind_array); | ||
475 | GNUNET_free (val_array); | ||
460 | return; /* not found */ | 476 | return; /* not found */ |
461 | 477 | } | |
462 | /* Update value */ | 478 | /* Update value */ |
479 | LOG (GNUNET_ERROR_TYPE_ERROR, "[P] Updating value for peer from `%.2f' to `%.2f'\n", | ||
480 | val_array[c1], val); | ||
463 | val_array[c1] = val; | 481 | val_array[c1] = val; |
464 | 482 | ||
465 | /* Update the row in the matrix */ | 483 | /* Update the row in the matrix */ |
466 | glp_set_mat_row (p->prob, row, c_elems, ind_array, val_array); | 484 | glp_set_mat_row (p->prob, row, c_elems, ind_array, val_array); |
467 | GNUNET_free (ind_array); | 485 | GNUNET_free (ind_array); |
468 | GNUNET_free (val_array); | 486 | GNUNET_free (val_array); |
469 | //p-> = GNUNET_YES; | ||
470 | } | 487 | } |
471 | 488 | ||
472 | /** | 489 | /** |
@@ -577,18 +594,19 @@ mlp_create_problem_add_address_information (void *cls, const struct GNUNET_HashC | |||
577 | int c; | 594 | int c; |
578 | 595 | ||
579 | /* Check if we have to add this peer due to a pending request */ | 596 | /* Check if we have to add this peer due to a pending request */ |
580 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->peers, key)) | 597 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->requested_peers, key)) |
581 | return GNUNET_OK; | 598 | return GNUNET_OK; |
582 | 599 | ||
583 | mlpi = address->solver_information; | 600 | mlpi = address->solver_information; |
584 | if (NULL == mlpi) | 601 | if (NULL == mlpi) |
585 | { | 602 | { |
603 | fprintf (stderr, "%s %p\n",GNUNET_i2s (&address->peer), address); | ||
586 | GNUNET_break (0); | 604 | GNUNET_break (0); |
587 | return GNUNET_OK; | 605 | return GNUNET_OK; |
588 | } | 606 | } |
589 | 607 | ||
590 | /* Get peer */ | 608 | /* Get peer */ |
591 | peer = GNUNET_CONTAINER_multihashmap_get (mlp->peers, key); | 609 | peer = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, key); |
592 | if (peer->processed == GNUNET_NO) | 610 | if (peer->processed == GNUNET_NO) |
593 | { | 611 | { |
594 | /* Add peer dependent constraints */ | 612 | /* Add peer dependent constraints */ |
@@ -602,7 +620,6 @@ mlp_create_problem_add_address_information (void *cls, const struct GNUNET_HashC | |||
602 | GNUNET_free (name); | 620 | GNUNET_free (name); |
603 | /* c 9) set coefficient */ | 621 | /* c 9) set coefficient */ |
604 | mlp_create_problem_set_value (p, peer->r_c9, p->c_r, -peer->f, __LINE__); | 622 | mlp_create_problem_set_value (p, peer->r_c9, p->c_r, -peer->f, __LINE__); |
605 | |||
606 | peer->processed = GNUNET_YES; | 623 | peer->processed = GNUNET_YES; |
607 | } | 624 | } |
608 | 625 | ||
@@ -799,8 +816,8 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp) | |||
799 | /* create the glpk problem */ | 816 | /* create the glpk problem */ |
800 | p->prob = glp_create_prob (); | 817 | p->prob = glp_create_prob (); |
801 | GNUNET_assert (NULL != p->prob); | 818 | GNUNET_assert (NULL != p->prob); |
802 | p->num_peers = GNUNET_CONTAINER_multihashmap_size (mlp->peers); | 819 | p->num_peers = GNUNET_CONTAINER_multihashmap_size (mlp->requested_peers); |
803 | p->num_addresses = mlp_create_problem_count_addresses (mlp->peers, mlp->addresses); | 820 | p->num_addresses = mlp_create_problem_count_addresses (mlp->requested_peers, mlp->addresses); |
804 | 821 | ||
805 | /* Create problem matrix: 10 * #addresses + #q * #addresses + #q, + #peer + 2 + 1 */ | 822 | /* Create problem matrix: 10 * #addresses + #q * #addresses + #q, + #peer + 2 + 1 */ |
806 | p->num_elements = (10 * p->num_addresses + mlp->pv.m_q * p->num_addresses + mlp->pv.m_q + p->num_peers + 2 + 1); | 823 | p->num_elements = (10 * p->num_addresses + mlp->pv.m_q * p->num_addresses + mlp->pv.m_q + p->num_peers + 2 + 1); |
@@ -931,7 +948,7 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value | |||
931 | double mlp_use = MLP_NaN; | 948 | double mlp_use = MLP_NaN; |
932 | 949 | ||
933 | /* Check if we have to add this peer due to a pending request */ | 950 | /* Check if we have to add this peer due to a pending request */ |
934 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->peers, key)) | 951 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->requested_peers, key)) |
935 | return GNUNET_OK; | 952 | return GNUNET_OK; |
936 | address = value; | 953 | address = value; |
937 | GNUNET_assert (address->solver_information != NULL); | 954 | GNUNET_assert (address->solver_information != NULL); |
@@ -1027,6 +1044,17 @@ GAS_mlp_solve_problem (void *solver) | |||
1027 | return GNUNET_NO; | 1044 | return GNUNET_NO; |
1028 | } | 1045 | } |
1029 | 1046 | ||
1047 | if (0 == GNUNET_CONTAINER_multihashmap_size(mlp->requested_peers)) | ||
1048 | { | ||
1049 | GNUNET_break (0); | ||
1050 | return GNUNET_OK; | ||
1051 | } | ||
1052 | if (0 == GNUNET_CONTAINER_multihashmap_size(mlp->addresses)) | ||
1053 | { | ||
1054 | GNUNET_break (0); | ||
1055 | return GNUNET_OK; | ||
1056 | } | ||
1057 | |||
1030 | if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == mlp->mlp_prob_updated)) | 1058 | if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == mlp->mlp_prob_updated)) |
1031 | { | 1059 | { |
1032 | LOG (GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n"); | 1060 | LOG (GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n"); |
@@ -1087,15 +1115,18 @@ GAS_mlp_solve_problem (void *solver) | |||
1087 | struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); | 1115 | struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); |
1088 | if (GNUNET_YES == mlp->write_mip_mps) | 1116 | if (GNUNET_YES == mlp->write_mip_mps) |
1089 | { | 1117 | { |
1090 | /* Write problem and solution to disk */ | 1118 | /* Write problem to disk */ |
1091 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); | 1119 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); |
1092 | glp_write_mps(mlp->p.prob, GLP_MPS_FILE, NULL, filename); | 1120 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); |
1093 | GNUNET_free (filename); | 1121 | glp_write_lp(mlp->p.prob, NULL, filename); |
1122 | GNUNET_free (filename); | ||
1094 | } | 1123 | } |
1095 | if (GNUNET_YES == mlp->write_mip_sol) | 1124 | if (GNUNET_YES == mlp->write_mip_sol) |
1096 | { | 1125 | { |
1126 | /* Write solution to disk */ | ||
1097 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); | 1127 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); |
1098 | glp_print_mip (mlp->p.prob, filename ); | 1128 | glp_print_mip (mlp->p.prob, filename ); |
1129 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); | ||
1099 | GNUNET_free (filename); | 1130 | GNUNET_free (filename); |
1100 | } | 1131 | } |
1101 | 1132 | ||
@@ -1147,7 +1178,7 @@ GAS_mlp_address_add (void *solver, | |||
1147 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding address for peer `%s' multiple times\n"), GNUNET_i2s(&address->peer)); | 1178 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding address for peer `%s' multiple times\n"), GNUNET_i2s(&address->peer)); |
1148 | 1179 | ||
1149 | /* Is this peer included in the problem? */ | 1180 | /* Is this peer included in the problem? */ |
1150 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->peers, &address->peer.hashPubKey))) | 1181 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey))) |
1151 | { | 1182 | { |
1152 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); | 1183 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); |
1153 | return; | 1184 | return; |
@@ -1414,7 +1445,7 @@ GAS_mlp_address_update (void *solver, | |||
1414 | mlp_update_quality (mlp, mlp->addresses, address, prev_atsi, prev_atsi_count); | 1445 | mlp_update_quality (mlp, mlp->addresses, address, prev_atsi, prev_atsi_count); |
1415 | 1446 | ||
1416 | /* Is this peer included in the problem? */ | 1447 | /* Is this peer included in the problem? */ |
1417 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->peers, &address->peer.hashPubKey))) | 1448 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey))) |
1418 | { | 1449 | { |
1419 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); | 1450 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); |
1420 | return; | 1451 | return; |
@@ -1449,23 +1480,27 @@ GAS_mlp_address_delete (void *solver, | |||
1449 | struct GAS_MLP_Handle *mlp = solver; | 1480 | struct GAS_MLP_Handle *mlp = solver; |
1450 | struct MLP_information *mlpi; | 1481 | struct MLP_information *mlpi; |
1451 | 1482 | ||
1452 | GNUNET_assert (NULL != solver);; | 1483 | GNUNET_assert (NULL != solver); |
1453 | GNUNET_assert (NULL != address); | 1484 | GNUNET_assert (NULL != address); |
1454 | 1485 | ||
1455 | mlpi = address->solver_information; | 1486 | mlpi = address->solver_information; |
1456 | if (NULL != mlpi) | 1487 | if ((GNUNET_NO == session_only) && (NULL != mlpi)) |
1457 | { | 1488 | { |
1458 | GNUNET_free (mlpi); | 1489 | GNUNET_free (mlpi); |
1459 | address->solver_information = NULL; | 1490 | address->solver_information = NULL; |
1460 | } | 1491 | } |
1461 | 1492 | ||
1462 | /* Is this peer included in the problem? */ | 1493 | /* Is this peer included in the problem? */ |
1463 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->peers, &address->peer.hashPubKey))) | 1494 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey))) |
1464 | { | 1495 | { |
1465 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); | 1496 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s for peer `%s' without address request \n", |
1497 | (session_only == GNUNET_YES) ? "session" : "address", | ||
1498 | GNUNET_i2s(&address->peer)); | ||
1466 | return; | 1499 | return; |
1467 | } | 1500 | } |
1468 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting address for peer `%s' with address request \n", GNUNET_i2s(&address->peer)); | 1501 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s for peer `%s' with address request \n", |
1502 | (session_only == GNUNET_YES) ? "session" : "address", | ||
1503 | GNUNET_i2s(&address->peer)); | ||
1469 | 1504 | ||
1470 | /* Problem size changed: new address for peer with pending request */ | 1505 | /* Problem size changed: new address for peer with pending request */ |
1471 | mlp->mlp_prob_changed = GNUNET_YES; | 1506 | mlp->mlp_prob_changed = GNUNET_YES; |
@@ -1546,15 +1581,15 @@ GAS_mlp_get_preferred_address (void *solver, | |||
1546 | GNUNET_i2s (peer)); | 1581 | GNUNET_i2s (peer)); |
1547 | 1582 | ||
1548 | /* Is this peer included in the problem? */ | 1583 | /* Is this peer included in the problem? */ |
1549 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->peers, &peer->hashPubKey))) | 1584 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) |
1550 | { | 1585 | { |
1551 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding peer `%s' to list of peers with requests\n", | 1586 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding peer `%s' to list of requested_peers with requests\n", |
1552 | GNUNET_i2s (peer)); | 1587 | GNUNET_i2s (peer)); |
1553 | 1588 | ||
1554 | p = GNUNET_malloc (sizeof (struct ATS_Peer)); | 1589 | p = GNUNET_malloc (sizeof (struct ATS_Peer)); |
1555 | p->id = (*peer); | 1590 | p->id = (*peer); |
1556 | p->f = get_peer_pref_value (mlp, peer); | 1591 | p->f = get_peer_pref_value (mlp, peer); |
1557 | GNUNET_CONTAINER_multihashmap_put (mlp->peers, &peer->hashPubKey, p, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 1592 | GNUNET_CONTAINER_multihashmap_put (mlp->requested_peers, &peer->hashPubKey, p, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
1558 | 1593 | ||
1559 | /* Added new peer, we have to rebuild problem before solving */ | 1594 | /* Added new peer, we have to rebuild problem before solving */ |
1560 | mlp->mlp_prob_changed = GNUNET_YES; | 1595 | mlp->mlp_prob_changed = GNUNET_YES; |
@@ -1627,9 +1662,9 @@ GAS_mlp_stop_get_preferred_address (void *solver, | |||
1627 | GNUNET_assert (NULL != solver); | 1662 | GNUNET_assert (NULL != solver); |
1628 | GNUNET_assert (NULL != peer); | 1663 | GNUNET_assert (NULL != peer); |
1629 | 1664 | ||
1630 | if (NULL != (p = GNUNET_CONTAINER_multihashmap_get (mlp->peers, &peer->hashPubKey))) | 1665 | if (NULL != (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) |
1631 | { | 1666 | { |
1632 | GNUNET_CONTAINER_multihashmap_remove (mlp->peers, &peer->hashPubKey, p); | 1667 | GNUNET_CONTAINER_multihashmap_remove (mlp->requested_peers, &peer->hashPubKey, p); |
1633 | GNUNET_free (p); | 1668 | GNUNET_free (p); |
1634 | } | 1669 | } |
1635 | } | 1670 | } |
@@ -1653,8 +1688,8 @@ GAS_mlp_address_change_preference (void *solver, | |||
1653 | struct GAS_MLP_Handle *mlp = solver; | 1688 | struct GAS_MLP_Handle *mlp = solver; |
1654 | struct ATS_Peer *p = NULL; | 1689 | struct ATS_Peer *p = NULL; |
1655 | 1690 | ||
1656 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Changing preference for address for peer `%s'\n", | 1691 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Changing preference for address for peer `%s' to %.2f\n", |
1657 | GNUNET_i2s(peer)); | 1692 | GNUNET_i2s(peer), pref_rel); |
1658 | 1693 | ||
1659 | GNUNET_STATISTICS_update (mlp->stats,"# LP address preference changes", 1, GNUNET_NO); | 1694 | GNUNET_STATISTICS_update (mlp->stats,"# LP address preference changes", 1, GNUNET_NO); |
1660 | /* Update the constraints with changed preferences */ | 1695 | /* Update the constraints with changed preferences */ |
@@ -1662,13 +1697,15 @@ GAS_mlp_address_change_preference (void *solver, | |||
1662 | /* Update quality constraint c7 */ | 1697 | /* Update quality constraint c7 */ |
1663 | 1698 | ||
1664 | /* Update relativity constraint c9 */ | 1699 | /* Update relativity constraint c9 */ |
1665 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->peers, &peer->hashPubKey))) | 1700 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) |
1666 | { | 1701 | { |
1667 | LOG (GNUNET_ERROR_TYPE_ERROR, "Updating preference for unknown peer `%s' \n", GNUNET_i2s(peer)); | 1702 | LOG (GNUNET_ERROR_TYPE_ERROR, "Updating preference for unknown peer `%s'\n", GNUNET_i2s(peer)); |
1668 | return; | 1703 | return; |
1669 | } | 1704 | } |
1670 | p->f = get_peer_pref_value (mlp, peer); | 1705 | p->f = get_peer_pref_value (mlp, peer); |
1671 | /* FXIME: cannot use set_value mlp_create_problem_set_value (&mlp->p, p->r_c9, mlp->p.c_r, -p->f, __LINE__);*/ | 1706 | LOG (GNUNET_ERROR_TYPE_ERROR, "PEER PREF: %s %.2f\n", |
1707 | GNUNET_i2s(peer), p->f); | ||
1708 | mlp_create_problem_update_value (&mlp->p, p->r_c9, mlp->p.c_r, -p->f, __LINE__); | ||
1672 | 1709 | ||
1673 | /* Problem size changed: new address for peer with pending request */ | 1710 | /* Problem size changed: new address for peer with pending request */ |
1674 | mlp->mlp_prob_updated = GNUNET_YES; | 1711 | mlp->mlp_prob_updated = GNUNET_YES; |
@@ -1705,9 +1742,9 @@ GAS_mlp_done (void *solver) | |||
1705 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n"); | 1742 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n"); |
1706 | mlp_delete_problem (mlp); | 1743 | mlp_delete_problem (mlp); |
1707 | 1744 | ||
1708 | GNUNET_CONTAINER_multihashmap_iterate (mlp->peers, &mlp_free_peers, mlp->peers); | 1745 | GNUNET_CONTAINER_multihashmap_iterate (mlp->requested_peers, &mlp_free_peers, mlp->requested_peers); |
1709 | GNUNET_CONTAINER_multihashmap_destroy (mlp->peers); | 1746 | GNUNET_CONTAINER_multihashmap_destroy (mlp->requested_peers); |
1710 | mlp->peers = NULL; | 1747 | mlp->requested_peers = NULL; |
1711 | 1748 | ||
1712 | /* Clean up GLPK environment */ | 1749 | /* Clean up GLPK environment */ |
1713 | glp_free_env(); | 1750 | glp_free_env(); |
@@ -1796,6 +1833,14 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1796 | break; | 1833 | break; |
1797 | } | 1834 | } |
1798 | 1835 | ||
1836 | mlp->write_mip_mps = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", | ||
1837 | "DUMP_MLP"); | ||
1838 | if (GNUNET_SYSERR == mlp->write_mip_mps) | ||
1839 | mlp->write_mip_mps = GNUNET_NO; | ||
1840 | mlp->write_mip_sol = GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", | ||
1841 | "DUMP_MLP"); | ||
1842 | if (GNUNET_SYSERR == mlp->write_mip_sol) | ||
1843 | mlp->write_mip_sol = GNUNET_NO; | ||
1799 | 1844 | ||
1800 | mlp->pv.BIG_M = (double) BIG_M_VALUE; | 1845 | mlp->pv.BIG_M = (double) BIG_M_VALUE; |
1801 | 1846 | ||
@@ -1968,12 +2013,10 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1968 | mlp->pv.b_min = b_min; | 2013 | mlp->pv.b_min = b_min; |
1969 | mlp->pv.n_min = n_min; | 2014 | mlp->pv.n_min = n_min; |
1970 | mlp->pv.m_q = GNUNET_ATS_QualityPropertiesCount; | 2015 | mlp->pv.m_q = GNUNET_ATS_QualityPropertiesCount; |
1971 | mlp->write_mip_mps = GNUNET_NO; | ||
1972 | mlp->write_mip_sol = GNUNET_NO; | ||
1973 | mlp->mlp_prob_changed = GNUNET_NO; | 2016 | mlp->mlp_prob_changed = GNUNET_NO; |
1974 | mlp->mlp_prob_updated = GNUNET_NO; | 2017 | mlp->mlp_prob_updated = GNUNET_NO; |
1975 | mlp->mlp_auto_solve = GNUNET_YES; | 2018 | mlp->mlp_auto_solve = GNUNET_YES; |
1976 | mlp->peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); | 2019 | mlp->requested_peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); |
1977 | mlp->bulk_request = 0; | 2020 | mlp->bulk_request = 0; |
1978 | mlp->bulk_lock = 0; | 2021 | mlp->bulk_lock = 0; |
1979 | 2022 | ||