diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 156 | ||||
-rw-r--r-- | src/ats/plugin_ats_mlp.h | 23 |
2 files changed, 91 insertions, 88 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index ac92fd305..1b87fe119 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -137,10 +137,6 @@ | |||
137 | */ | 137 | */ |
138 | #define DEBUG_MLP_PROBLEM_CREATION GNUNET_NO | 138 | #define DEBUG_MLP_PROBLEM_CREATION GNUNET_NO |
139 | 139 | ||
140 | /** | ||
141 | * Enable GLPK verbose output | ||
142 | */ | ||
143 | #define VERBOSE_GLPK GNUNET_NO | ||
144 | 140 | ||
145 | /** | 141 | /** |
146 | * Maximize bandwidth assigned | 142 | * Maximize bandwidth assigned |
@@ -161,7 +157,7 @@ static int | |||
161 | mlp_term_hook (void *info, const char *s) | 157 | mlp_term_hook (void *info, const char *s) |
162 | { | 158 | { |
163 | /* Not needed atm struct MLP_information *mlp = info; */ | 159 | /* Not needed atm struct MLP_information *mlp = info; */ |
164 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s", s); | 160 | LOG (GNUNET_ERROR_TYPE_ERROR, "%s", s); |
165 | return 1; | 161 | return 1; |
166 | } | 162 | } |
167 | 163 | ||
@@ -1136,13 +1132,13 @@ GAS_mlp_solve_problem (void *solver) | |||
1136 | 1132 | ||
1137 | GNUNET_assert(NULL != solver); | 1133 | GNUNET_assert(NULL != solver); |
1138 | 1134 | ||
1139 | if (GNUNET_YES == mlp->bulk_lock) | 1135 | if (GNUNET_YES == mlp->stat_bulk_lock) |
1140 | { | 1136 | { |
1141 | mlp->bulk_request++; | 1137 | mlp->stat_bulk_requests++; |
1142 | return GNUNET_NO; | 1138 | return GNUNET_NO; |
1143 | } | 1139 | } |
1144 | notify(mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, | 1140 | notify(mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, |
1145 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1141 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1146 | start_total = GNUNET_TIME_absolute_get(); | 1142 | start_total = GNUNET_TIME_absolute_get(); |
1147 | 1143 | ||
1148 | if (0 == GNUNET_CONTAINER_multipeermap_size(mlp->requested_peers)) | 1144 | if (0 == GNUNET_CONTAINER_multipeermap_size(mlp->requested_peers)) |
@@ -1156,14 +1152,14 @@ GAS_mlp_solve_problem (void *solver) | |||
1156 | return GNUNET_OK; /* No addresses available */ | 1152 | return GNUNET_OK; /* No addresses available */ |
1157 | } | 1153 | } |
1158 | 1154 | ||
1159 | if ((GNUNET_NO == mlp->mlp_prob_changed) | 1155 | if ((GNUNET_NO == mlp->stat_mlp_prob_changed) |
1160 | && (GNUNET_NO == mlp->mlp_prob_updated)) | 1156 | && (GNUNET_NO == mlp->stat_mlp_prob_updated)) |
1161 | { | 1157 | { |
1162 | LOG(GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n"); | 1158 | LOG(GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n"); |
1163 | notify(mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE); | 1159 | notify(mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE); |
1164 | return GNUNET_OK; | 1160 | return GNUNET_OK; |
1165 | } | 1161 | } |
1166 | if (GNUNET_YES == mlp->mlp_prob_changed) | 1162 | if (GNUNET_YES == mlp->stat_mlp_prob_changed) |
1167 | { | 1163 | { |
1168 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); | 1164 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); |
1169 | notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL); | 1165 | notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL); |
@@ -1185,21 +1181,21 @@ GAS_mlp_solve_problem (void *solver) | |||
1185 | dur_setup = GNUNET_TIME_absolute_get_duration (start_total); | 1181 | dur_setup = GNUNET_TIME_absolute_get_duration (start_total); |
1186 | 1182 | ||
1187 | /* Run LP solver */ | 1183 | /* Run LP solver */ |
1188 | mlp->control_param_lp.presolve = GLP_YES; | ||
1189 | notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS, | 1184 | notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS, |
1190 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1185 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1191 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 1186 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
1192 | "Running LP solver %s\n", | 1187 | "Running LP solver %s\n", |
1193 | (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); | 1188 | (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); |
1194 | start_cur_op = GNUNET_TIME_absolute_get(); | 1189 | start_cur_op = GNUNET_TIME_absolute_get(); |
1195 | 1190 | ||
1196 | /* Solve LP */ | 1191 | /* Solve LP */ |
1192 | mlp->control_param_lp.presolve = GLP_YES; | ||
1197 | res_lp = mlp_solve_lp_problem(mlp); | 1193 | res_lp = mlp_solve_lp_problem(mlp); |
1198 | 1194 | ||
1199 | dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op); | 1195 | dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op); |
1200 | notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP, | 1196 | notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP, |
1201 | (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | 1197 | (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, |
1202 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1198 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1203 | 1199 | ||
1204 | 1200 | ||
1205 | /* Run MLP solver */ | 1201 | /* Run MLP solver */ |
@@ -1207,10 +1203,11 @@ GAS_mlp_solve_problem (void *solver) | |||
1207 | { | 1203 | { |
1208 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); | 1204 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); |
1209 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS, | 1205 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS, |
1210 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1206 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1211 | start_cur_op = GNUNET_TIME_absolute_get(); | 1207 | start_cur_op = GNUNET_TIME_absolute_get(); |
1212 | 1208 | ||
1213 | /* Solve MIP */ | 1209 | /* Solve MIP */ |
1210 | //mlp->control_param_mlp.presolve = GNUNET_YES; | ||
1214 | res_mip = mlp_solve_mlp_problem(mlp); | 1211 | res_mip = mlp_solve_mlp_problem(mlp); |
1215 | 1212 | ||
1216 | dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op); | 1213 | dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op); |
@@ -1218,7 +1215,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1218 | 1215 | ||
1219 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, | 1216 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, |
1220 | (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | 1217 | (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, |
1221 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1218 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1222 | } | 1219 | } |
1223 | else | 1220 | else |
1224 | { | 1221 | { |
@@ -1226,7 +1223,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1226 | dur_mlp = GNUNET_TIME_UNIT_ZERO; | 1223 | dur_mlp = GNUNET_TIME_UNIT_ZERO; |
1227 | dur_total = GNUNET_TIME_absolute_get_duration (start_total); | 1224 | dur_total = GNUNET_TIME_absolute_get_duration (start_total); |
1228 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, GAS_STAT_FAIL, | 1225 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, GAS_STAT_FAIL, |
1229 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1226 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1230 | res_mip = GNUNET_SYSERR; | 1227 | res_mip = GNUNET_SYSERR; |
1231 | } | 1228 | } |
1232 | 1229 | ||
@@ -1234,11 +1231,11 @@ GAS_mlp_solve_problem (void *solver) | |||
1234 | /* Notify about end */ | 1231 | /* Notify about end */ |
1235 | notify(mlp, GAS_OP_SOLVE_STOP, | 1232 | notify(mlp, GAS_OP_SOLVE_STOP, |
1236 | ((GNUNET_OK == res_mip) && (GNUNET_OK == res_mip)) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | 1233 | ((GNUNET_OK == res_mip) && (GNUNET_OK == res_mip)) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, |
1237 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1234 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1238 | 1235 | ||
1239 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1236 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1240 | "Execution time for %s solve: (total/setup/lp/mlp) : %llu %llu %llu %llu\n", | 1237 | "Execution time for %s solve: (total/setup/lp/mlp) : %llu %llu %llu %llu\n", |
1241 | (GNUNET_YES == mlp->mlp_prob_changed) ? "full" : "updated", | 1238 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? "full" : "updated", |
1242 | (unsigned long long) dur_total.rel_value_us, | 1239 | (unsigned long long) dur_total.rel_value_us, |
1243 | (unsigned long long) dur_setup.rel_value_us, | 1240 | (unsigned long long) dur_setup.rel_value_us, |
1244 | (unsigned long long) dur_lp.rel_value_us, | 1241 | (unsigned long long) dur_lp.rel_value_us, |
@@ -1267,8 +1264,8 @@ GAS_mlp_solve_problem (void *solver) | |||
1267 | GAS_INFO_NONE); | 1264 | GAS_INFO_NONE); |
1268 | 1265 | ||
1269 | struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); | 1266 | struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); |
1270 | if ( (GNUNET_YES == mlp->dump_solution_all) || | 1267 | if ( (GNUNET_YES == mlp->opt_dump_solution_all) || |
1271 | (mlp->dump_solution_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) ) | 1268 | (mlp->opt_dump_solution_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) ) |
1272 | { | 1269 | { |
1273 | /* Write problem to disk */ | 1270 | /* Write problem to disk */ |
1274 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.lp", mlp->p.num_peers, | 1271 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.lp", mlp->p.num_peers, |
@@ -1277,8 +1274,8 @@ GAS_mlp_solve_problem (void *solver) | |||
1277 | glp_write_lp (mlp->p.prob, NULL, filename); | 1274 | glp_write_lp (mlp->p.prob, NULL, filename); |
1278 | GNUNET_free(filename); | 1275 | GNUNET_free(filename); |
1279 | } | 1276 | } |
1280 | if ( (mlp->dump_solution_all) || | 1277 | if ( (mlp->opt_dump_solution_all) || |
1281 | (mlp->dump_solution_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) ) | 1278 | (mlp->opt_dump_solution_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) ) |
1282 | { | 1279 | { |
1283 | /* Write solution to disk */ | 1280 | /* Write solution to disk */ |
1284 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, | 1281 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, |
@@ -1290,8 +1287,8 @@ GAS_mlp_solve_problem (void *solver) | |||
1290 | 1287 | ||
1291 | /* Reset change and update marker */ | 1288 | /* Reset change and update marker */ |
1292 | mlp->control_param_lp.presolve = GLP_NO; | 1289 | mlp->control_param_lp.presolve = GLP_NO; |
1293 | mlp->mlp_prob_updated = GNUNET_NO; | 1290 | mlp->stat_mlp_prob_updated = GNUNET_NO; |
1294 | mlp->mlp_prob_changed = GNUNET_NO; | 1291 | mlp->stat_mlp_prob_changed = GNUNET_NO; |
1295 | 1292 | ||
1296 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) | 1293 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) |
1297 | return GNUNET_OK; | 1294 | return GNUNET_OK; |
@@ -1342,8 +1339,8 @@ GAS_mlp_address_add (void *solver, | |||
1342 | 1339 | ||
1343 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' with address request \n", GNUNET_i2s(&address->peer)); | 1340 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' with address request \n", GNUNET_i2s(&address->peer)); |
1344 | /* Problem size changed: new address for peer with pending request */ | 1341 | /* Problem size changed: new address for peer with pending request */ |
1345 | mlp->mlp_prob_changed = GNUNET_YES; | 1342 | mlp->stat_mlp_prob_changed = GNUNET_YES; |
1346 | if (GNUNET_YES == mlp->mlp_auto_solve) | 1343 | if (GNUNET_YES == mlp->opt_mlp_auto_solve) |
1347 | GAS_mlp_solve_problem (solver); | 1344 | GAS_mlp_solve_problem (solver); |
1348 | } | 1345 | } |
1349 | 1346 | ||
@@ -1414,8 +1411,8 @@ GAS_mlp_address_property_changed (void *solver, | |||
1414 | if (GNUNET_YES == mlp_create_problem_update_value (&mlp->p, | 1411 | if (GNUNET_YES == mlp_create_problem_update_value (&mlp->p, |
1415 | mlp->p.r_q[type_index], mlpi->c_b, rel_value, __LINE__)) | 1412 | mlp->p.r_q[type_index], mlpi->c_b, rel_value, __LINE__)) |
1416 | { | 1413 | { |
1417 | mlp->mlp_prob_updated = GNUNET_YES; | 1414 | mlp->stat_mlp_prob_updated = GNUNET_YES; |
1418 | if (GNUNET_YES == mlp->mlp_auto_solve) | 1415 | if (GNUNET_YES == mlp->opt_mlp_auto_solve) |
1419 | GAS_mlp_solve_problem (solver); | 1416 | GAS_mlp_solve_problem (solver); |
1420 | } | 1417 | } |
1421 | } | 1418 | } |
@@ -1561,7 +1558,7 @@ GAS_mlp_address_change_network (void *solver, | |||
1561 | } | 1558 | } |
1562 | } | 1559 | } |
1563 | 1560 | ||
1564 | mlp->mlp_prob_changed = GNUNET_YES; | 1561 | mlp->stat_mlp_prob_changed = GNUNET_YES; |
1565 | } | 1562 | } |
1566 | 1563 | ||
1567 | 1564 | ||
@@ -1613,8 +1610,8 @@ GAS_mlp_address_delete (void *solver, | |||
1613 | GNUNET_i2s(&address->peer)); | 1610 | GNUNET_i2s(&address->peer)); |
1614 | 1611 | ||
1615 | /* Problem size changed: new address for peer with pending request */ | 1612 | /* Problem size changed: new address for peer with pending request */ |
1616 | mlp->mlp_prob_changed = GNUNET_YES; | 1613 | mlp->stat_mlp_prob_changed = GNUNET_YES; |
1617 | if (GNUNET_YES == mlp->mlp_auto_solve) | 1614 | if (GNUNET_YES == mlp->opt_mlp_auto_solve) |
1618 | { | 1615 | { |
1619 | GAS_mlp_solve_problem (solver); | 1616 | GAS_mlp_solve_problem (solver); |
1620 | } | 1617 | } |
@@ -1731,9 +1728,9 @@ GAS_mlp_get_preferred_address (void *solver, | |||
1731 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 1728 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
1732 | 1729 | ||
1733 | /* Added new peer, we have to rebuild problem before solving */ | 1730 | /* Added new peer, we have to rebuild problem before solving */ |
1734 | mlp->mlp_prob_changed = GNUNET_YES; | 1731 | mlp->stat_mlp_prob_changed = GNUNET_YES; |
1735 | 1732 | ||
1736 | if ((GNUNET_YES == mlp->mlp_auto_solve)&& | 1733 | if ((GNUNET_YES == mlp->opt_mlp_auto_solve)&& |
1737 | (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains(mlp->addresses, | 1734 | (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains(mlp->addresses, |
1738 | peer))) | 1735 | peer))) |
1739 | { | 1736 | { |
@@ -1763,7 +1760,7 @@ GAS_mlp_bulk_start (void *solver) | |||
1763 | 1760 | ||
1764 | GNUNET_assert (NULL != solver); | 1761 | GNUNET_assert (NULL != solver); |
1765 | 1762 | ||
1766 | s->bulk_lock ++; | 1763 | s->stat_bulk_lock ++; |
1767 | } | 1764 | } |
1768 | 1765 | ||
1769 | void | 1766 | void |
@@ -1774,17 +1771,17 @@ GAS_mlp_bulk_stop (void *solver) | |||
1774 | struct GAS_MLP_Handle *s = (struct GAS_MLP_Handle *) solver; | 1771 | struct GAS_MLP_Handle *s = (struct GAS_MLP_Handle *) solver; |
1775 | GNUNET_assert (NULL != solver); | 1772 | GNUNET_assert (NULL != solver); |
1776 | 1773 | ||
1777 | if (s->bulk_lock < 1) | 1774 | if (s->stat_bulk_lock < 1) |
1778 | { | 1775 | { |
1779 | GNUNET_break (0); | 1776 | GNUNET_break (0); |
1780 | return; | 1777 | return; |
1781 | } | 1778 | } |
1782 | s->bulk_lock --; | 1779 | s->stat_bulk_lock --; |
1783 | 1780 | ||
1784 | if (0 < s->bulk_request) | 1781 | if (0 < s->stat_bulk_requests) |
1785 | { | 1782 | { |
1786 | GAS_mlp_solve_problem (solver); | 1783 | GAS_mlp_solve_problem (solver); |
1787 | s->bulk_request= 0; | 1784 | s->stat_bulk_requests= 0; |
1788 | } | 1785 | } |
1789 | } | 1786 | } |
1790 | 1787 | ||
@@ -1810,8 +1807,8 @@ GAS_mlp_stop_get_preferred_address (void *solver, | |||
1810 | GNUNET_CONTAINER_multipeermap_remove (mlp->requested_peers, peer, p); | 1807 | GNUNET_CONTAINER_multipeermap_remove (mlp->requested_peers, peer, p); |
1811 | GNUNET_free (p); | 1808 | GNUNET_free (p); |
1812 | 1809 | ||
1813 | mlp->mlp_prob_changed = GNUNET_YES; | 1810 | mlp->stat_mlp_prob_changed = GNUNET_YES; |
1814 | if (GNUNET_YES == mlp->mlp_auto_solve) | 1811 | if (GNUNET_YES == mlp->opt_mlp_auto_solve) |
1815 | { | 1812 | { |
1816 | GAS_mlp_solve_problem (solver); | 1813 | GAS_mlp_solve_problem (solver); |
1817 | } | 1814 | } |
@@ -1857,8 +1854,8 @@ GAS_mlp_address_change_preference (void *solver, | |||
1857 | mlp_create_problem_update_value (&mlp->p, p->r_c9, mlp->p.c_r, -p->f, __LINE__); | 1854 | mlp_create_problem_update_value (&mlp->p, p->r_c9, mlp->p.c_r, -p->f, __LINE__); |
1858 | 1855 | ||
1859 | /* Problem size changed: new address for peer with pending request */ | 1856 | /* Problem size changed: new address for peer with pending request */ |
1860 | mlp->mlp_prob_updated = GNUNET_YES; | 1857 | mlp->stat_mlp_prob_updated = GNUNET_YES; |
1861 | if (GNUNET_YES == mlp->mlp_auto_solve) | 1858 | if (GNUNET_YES == mlp->opt_mlp_auto_solve) |
1862 | GAS_mlp_solve_problem (solver); | 1859 | GAS_mlp_solve_problem (solver); |
1863 | return; | 1860 | return; |
1864 | } | 1861 | } |
@@ -1987,25 +1984,30 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
1987 | break; | 1984 | break; |
1988 | } | 1985 | } |
1989 | 1986 | ||
1990 | mlp->dump_problem_all = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | 1987 | mlp->opt_dump_problem_all = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, |
1991 | "ats", "DUMP_PROBLEM_ALL"); | 1988 | "ats", "MLP_DUMP_PROBLEM_ALL"); |
1992 | if (GNUNET_SYSERR == mlp->dump_problem_all) | 1989 | if (GNUNET_SYSERR == mlp->opt_dump_problem_all) |
1993 | mlp->dump_problem_all = GNUNET_NO; | 1990 | mlp->opt_dump_problem_all = GNUNET_NO; |
1994 | 1991 | ||
1995 | mlp->dump_solution_all = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | 1992 | mlp->opt_dump_solution_all = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, |
1996 | "ats", "DUMP_SOLUTION_ALL"); | 1993 | "ats", "MLP_DUMP_SOLUTION_ALL"); |
1997 | if (GNUNET_SYSERR == mlp->dump_solution_all) | 1994 | if (GNUNET_SYSERR == mlp->opt_dump_solution_all) |
1998 | mlp->dump_solution_all = GNUNET_NO; | 1995 | mlp->opt_dump_solution_all = GNUNET_NO; |
1999 | 1996 | ||
2000 | mlp->dump_problem_on_fail = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | 1997 | mlp->opt_dump_problem_on_fail = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, |
2001 | "ats", "DUMP_PROBLEM_ON_FAIL"); | 1998 | "ats", "MLP_DUMP_PROBLEM_ON_FAIL"); |
2002 | if (GNUNET_SYSERR == mlp->dump_problem_on_fail) | 1999 | if (GNUNET_SYSERR == mlp->opt_dump_problem_on_fail) |
2003 | mlp->dump_problem_on_fail = GNUNET_NO; | 2000 | mlp->opt_dump_problem_on_fail = GNUNET_NO; |
2004 | 2001 | ||
2005 | mlp->dump_solution_on_fail = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | 2002 | mlp->opt_dump_solution_on_fail = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, |
2006 | "ats", "DUMP_SOLUTION_ON_FAIL"); | 2003 | "ats", "MLP_DUMP_SOLUTION_ON_FAIL"); |
2007 | if (GNUNET_SYSERR == mlp->dump_solution_on_fail) | 2004 | if (GNUNET_SYSERR == mlp->opt_dump_solution_on_fail) |
2008 | mlp->dump_solution_on_fail = GNUNET_NO; | 2005 | mlp->opt_dump_solution_on_fail = GNUNET_NO; |
2006 | |||
2007 | mlp->opt_glpk_verbose = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | ||
2008 | "ats", "MLP_GLPK_VERBOSE"); | ||
2009 | if (GNUNET_SYSERR == mlp->opt_glpk_verbose) | ||
2010 | mlp->opt_glpk_verbose = GNUNET_NO; | ||
2009 | 2011 | ||
2010 | mlp->pv.BIG_M = (double) BIG_M_VALUE; | 2012 | mlp->pv.BIG_M = (double) BIG_M_VALUE; |
2011 | 2013 | ||
@@ -2024,25 +2026,22 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2024 | } | 2026 | } |
2025 | 2027 | ||
2026 | /* Get diversity coefficient from configuration */ | 2028 | /* Get diversity coefficient from configuration */ |
2027 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats", | 2029 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, |
2028 | "MLP_COEFFICIENT_D", | 2030 | "ats", "MLP_COEFFICIENT_D", &tmp)) |
2029 | &tmp)) | ||
2030 | D = (double) tmp / 100; | 2031 | D = (double) tmp / 100; |
2031 | else | 2032 | else |
2032 | D = DEFAULT_D; | 2033 | D = DEFAULT_D; |
2033 | 2034 | ||
2034 | /* Get proportionality coefficient from configuration */ | 2035 | /* Get proportionality coefficient from configuration */ |
2035 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats", | 2036 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, |
2036 | "MLP_COEFFICIENT_R", | 2037 | "ats", "MLP_COEFFICIENT_R", &tmp)) |
2037 | &tmp)) | ||
2038 | R = (double) tmp / 100; | 2038 | R = (double) tmp / 100; |
2039 | else | 2039 | else |
2040 | R = DEFAULT_R; | 2040 | R = DEFAULT_R; |
2041 | 2041 | ||
2042 | /* Get utilization coefficient from configuration */ | 2042 | /* Get utilization coefficient from configuration */ |
2043 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats", | 2043 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, |
2044 | "MLP_COEFFICIENT_U", | 2044 | "ats", "MLP_COEFFICIENT_U", &tmp)) |
2045 | &tmp)) | ||
2046 | U = (double) tmp / 100; | 2045 | U = (double) tmp / 100; |
2047 | else | 2046 | else |
2048 | U = DEFAULT_U; | 2047 | U = DEFAULT_U; |
@@ -2198,12 +2197,12 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2198 | mlp->pv.b_min = b_min; | 2197 | mlp->pv.b_min = b_min; |
2199 | mlp->pv.n_min = n_min; | 2198 | mlp->pv.n_min = n_min; |
2200 | mlp->pv.m_q = GNUNET_ATS_QualityPropertiesCount; | 2199 | mlp->pv.m_q = GNUNET_ATS_QualityPropertiesCount; |
2201 | mlp->mlp_prob_changed = GNUNET_NO; | 2200 | mlp->stat_mlp_prob_changed = GNUNET_NO; |
2202 | mlp->mlp_prob_updated = GNUNET_NO; | 2201 | mlp->stat_mlp_prob_updated = GNUNET_NO; |
2203 | mlp->mlp_auto_solve = GNUNET_YES; | 2202 | mlp->opt_mlp_auto_solve = GNUNET_YES; |
2204 | mlp->requested_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); | 2203 | mlp->requested_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
2205 | mlp->bulk_request = 0; | 2204 | mlp->stat_bulk_requests = 0; |
2206 | mlp->bulk_lock = 0; | 2205 | mlp->stat_bulk_lock = 0; |
2207 | 2206 | ||
2208 | /* Setup GLPK */ | 2207 | /* Setup GLPK */ |
2209 | /* Redirect GLPK output to GNUnet logging */ | 2208 | /* Redirect GLPK output to GNUnet logging */ |
@@ -2212,18 +2211,17 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2212 | /* Init LP solving parameters */ | 2211 | /* Init LP solving parameters */ |
2213 | glp_init_smcp(&mlp->control_param_lp); | 2212 | glp_init_smcp(&mlp->control_param_lp); |
2214 | mlp->control_param_lp.msg_lev = GLP_MSG_OFF; | 2213 | mlp->control_param_lp.msg_lev = GLP_MSG_OFF; |
2215 | #if VERBOSE_GLPK | 2214 | if (GNUNET_YES == mlp->opt_glpk_verbose) |
2216 | mlp->control_param_lp.msg_lev = GLP_MSG_ALL; | 2215 | mlp->control_param_lp.msg_lev = GLP_MSG_ALL; |
2217 | #endif | 2216 | |
2218 | mlp->control_param_lp.it_lim = max_iterations; | 2217 | mlp->control_param_lp.it_lim = max_iterations; |
2219 | mlp->control_param_lp.tm_lim = max_duration.rel_value_us / 1000LL; | 2218 | mlp->control_param_lp.tm_lim = max_duration.rel_value_us / 1000LL; |
2220 | 2219 | ||
2221 | /* Init MLP solving parameters */ | 2220 | /* Init MLP solving parameters */ |
2222 | glp_init_iocp(&mlp->control_param_mlp); | 2221 | glp_init_iocp(&mlp->control_param_mlp); |
2223 | mlp->control_param_mlp.msg_lev = GLP_MSG_OFF; | 2222 | mlp->control_param_mlp.msg_lev = GLP_MSG_OFF; |
2224 | #if VERBOSE_GLPK | 2223 | if (GNUNET_YES == mlp->opt_glpk_verbose) |
2225 | mlp->control_param_mlp.msg_lev = GLP_MSG_ALL; | 2224 | mlp->control_param_mlp.msg_lev = GLP_MSG_ALL; |
2226 | #endif | ||
2227 | mlp->control_param_mlp.tm_lim = max_duration.rel_value_us / 1000LL; | 2225 | mlp->control_param_mlp.tm_lim = max_duration.rel_value_us / 1000LL; |
2228 | 2226 | ||
2229 | LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n"); | 2227 | LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n"); |
diff --git a/src/ats/plugin_ats_mlp.h b/src/ats/plugin_ats_mlp.h index 2ef640e75..12e72d53c 100644 --- a/src/ats/plugin_ats_mlp.h +++ b/src/ats/plugin_ats_mlp.h | |||
@@ -269,12 +269,12 @@ struct GAS_MLP_Handle | |||
269 | * Bulk lock | 269 | * Bulk lock |
270 | */ | 270 | */ |
271 | 271 | ||
272 | int bulk_lock; | 272 | int stat_bulk_lock; |
273 | 273 | ||
274 | /** | 274 | /** |
275 | * Number of changes while solver was locked | 275 | * Number of changes while solver was locked |
276 | */ | 276 | */ |
277 | int bulk_request; | 277 | int stat_bulk_requests; |
278 | 278 | ||
279 | /** | 279 | /** |
280 | * GLPK LP control parameter | 280 | * GLPK LP control parameter |
@@ -302,39 +302,44 @@ struct GAS_MLP_Handle | |||
302 | /** | 302 | /** |
303 | * Was the problem updated since last solution | 303 | * Was the problem updated since last solution |
304 | */ | 304 | */ |
305 | int mlp_prob_updated; | 305 | int stat_mlp_prob_updated; |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Has the problem size changed since last solution | 308 | * Has the problem size changed since last solution |
309 | */ | 309 | */ |
310 | int mlp_prob_changed; | 310 | int stat_mlp_prob_changed; |
311 | 311 | ||
312 | /** | 312 | /** |
313 | * Solve the problem automatically when updates occur? | 313 | * Solve the problem automatically when updates occur? |
314 | * Default: GNUNET_YES | 314 | * Default: GNUNET_YES |
315 | * Can be disabled for test and measurements | 315 | * Can be disabled for test and measurements |
316 | */ | 316 | */ |
317 | int mlp_auto_solve; | 317 | int opt_mlp_auto_solve; |
318 | 318 | ||
319 | /** | 319 | /** |
320 | * Write all MILP problems to a MPS file | 320 | * Write all MILP problems to a MPS file |
321 | */ | 321 | */ |
322 | int dump_problem_all; | 322 | int opt_dump_problem_all; |
323 | 323 | ||
324 | /** | 324 | /** |
325 | * Write all MILP problem solutions to a file | 325 | * Write all MILP problem solutions to a file |
326 | */ | 326 | */ |
327 | int dump_solution_all; | 327 | int opt_dump_solution_all; |
328 | 328 | ||
329 | /** | 329 | /** |
330 | * Write MILP problems to a MPS file when solver fails | 330 | * Write MILP problems to a MPS file when solver fails |
331 | */ | 331 | */ |
332 | int dump_problem_on_fail; | 332 | int opt_dump_problem_on_fail; |
333 | 333 | ||
334 | /** | 334 | /** |
335 | * Write MILP problem solutions to a file when solver fails | 335 | * Write MILP problem solutions to a file when solver fails |
336 | */ | 336 | */ |
337 | int dump_solution_on_fail; | 337 | int opt_dump_solution_on_fail; |
338 | |||
339 | /** | ||
340 | * Print GLPK output | ||
341 | */ | ||
342 | int opt_glpk_verbose; | ||
338 | 343 | ||
339 | }; | 344 | }; |
340 | 345 | ||