diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-12 20:01:32 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-12 20:01:32 +0000 |
commit | 72f0b708d9e177fe54d10c0414db77c9578aa5cd (patch) | |
tree | f802f2c084b22342eae99fe69704b6858c5f3f0a /src/ats/plugin_ats_mlp.c | |
parent | 116e346f3d01eaede6f48ef8aa0c9e03c71b0c19 (diff) | |
download | gnunet-72f0b708d9e177fe54d10c0414db77c9578aa5cd.tar.gz gnunet-72f0b708d9e177fe54d10c0414db77c9578aa5cd.zip |
logging improvement for perf tool
intopt presolver support + cfg option
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index 07d9b9ea9..251283781 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -1177,48 +1177,61 @@ GAS_mlp_solve_problem (void *solver) | |||
1177 | return GNUNET_OK; | 1177 | return GNUNET_OK; |
1178 | } | 1178 | } |
1179 | if (GNUNET_YES == mlp->stat_mlp_prob_changed) | 1179 | if (GNUNET_YES == mlp->stat_mlp_prob_changed) |
1180 | { | ||
1181 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); | ||
1182 | notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL); | ||
1183 | mlp_delete_problem(mlp); | ||
1184 | if (GNUNET_SYSERR == mlp_create_problem(mlp)) | ||
1185 | { | ||
1186 | notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL, GAS_INFO_FULL); | ||
1187 | return GNUNET_SYSERR; | ||
1188 | } | ||
1189 | notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, GAS_INFO_FULL); | ||
1190 | if (GNUNET_NO == mlp->opt_dbg_intopt_presolver) | ||
1180 | { | 1191 | { |
1181 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); | 1192 | mlp->control_param_lp.presolve = GLP_YES; /* LP presolver, we need lp solution */ |
1182 | notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL); | 1193 | mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP solution */ |
1183 | mlp_delete_problem(mlp); | ||
1184 | if (GNUNET_SYSERR == mlp_create_problem(mlp)) | ||
1185 | { | ||
1186 | notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL, GAS_INFO_FULL); | ||
1187 | return GNUNET_SYSERR; | ||
1188 | } | ||
1189 | notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, GAS_INFO_FULL); | ||
1190 | mlp->control_param_lp.presolve = GLP_YES; /* LP presolver, we need lp solution */ | ||
1191 | mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP solution */ | ||
1192 | } | 1194 | } |
1193 | else | 1195 | else |
1194 | { | 1196 | { |
1195 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); | 1197 | mlp->control_param_lp.presolve = GNUNET_NO; /* LP presolver, we need lp solution */ |
1198 | mlp->control_param_mlp.presolve = GLP_YES; /* No presolver, we have LP solution */ | ||
1199 | dur_lp = GNUNET_TIME_UNIT_ZERO; | ||
1196 | } | 1200 | } |
1201 | } | ||
1202 | else | ||
1203 | { | ||
1204 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); | ||
1205 | } | ||
1197 | 1206 | ||
1198 | dur_setup = GNUNET_TIME_absolute_get_duration (start_total); | 1207 | dur_setup = GNUNET_TIME_absolute_get_duration (start_total); |
1199 | 1208 | ||
1200 | /* Run LP solver */ | 1209 | /* Run LP solver */ |
1201 | notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS, | 1210 | if (GNUNET_NO == mlp->opt_dbg_intopt_presolver) |
1202 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | 1211 | { |
1203 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 1212 | notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS, |
1204 | "Running LP solver %s\n", | 1213 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); |
1205 | (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); | 1214 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
1206 | start_cur_op = GNUNET_TIME_absolute_get(); | 1215 | "Running LP solver %s\n", |
1207 | 1216 | (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); | |
1208 | /* Solve LP */ | 1217 | start_cur_op = GNUNET_TIME_absolute_get(); |
1209 | /* Only for debugging, always use LP presolver: | 1218 | |
1210 | * mlp->control_param_lp.presolve = GLP_YES; */ | 1219 | /* Solve LP */ |
1211 | res_lp = mlp_solve_lp_problem(mlp); | 1220 | /* Only for debugging, always use LP presolver: |
1212 | 1221 | * mlp->control_param_lp.presolve = GLP_YES; */ | |
1213 | dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op); | 1222 | res_lp = mlp_solve_lp_problem(mlp); |
1214 | notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP, | ||
1215 | (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | ||
1216 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | ||
1217 | 1223 | ||
1218 | res_lp = GNUNET_OK; | 1224 | dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op); |
1225 | notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP, | ||
1226 | (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | ||
1227 | (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); | ||
1228 | } | ||
1229 | |||
1230 | if (GNUNET_YES == mlp->opt_dbg_intopt_presolver) | ||
1231 | res_lp = GNUNET_OK; | ||
1219 | 1232 | ||
1220 | /* Run MLP solver */ | 1233 | /* Run MLP solver */ |
1221 | if (GNUNET_OK == res_lp) | 1234 | if ((GNUNET_OK == res_lp) || (GNUNET_YES == mlp->opt_dbg_intopt_presolver)) |
1222 | { | 1235 | { |
1223 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); | 1236 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); |
1224 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS, | 1237 | notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS, |
@@ -1226,8 +1239,9 @@ GAS_mlp_solve_problem (void *solver) | |||
1226 | start_cur_op = GNUNET_TIME_absolute_get(); | 1239 | start_cur_op = GNUNET_TIME_absolute_get(); |
1227 | 1240 | ||
1228 | /* Solve MIP */ | 1241 | /* Solve MIP */ |
1229 | /* Only for debugging, always use MLP presolver: | 1242 | /* Only for debugging, always use MLP presolver */ |
1230 | * mlp->control_param_mlp.presolve = GNUNET_YES; */ | 1243 | if (GNUNET_YES == mlp->opt_dbg_intopt_presolver) |
1244 | mlp->control_param_mlp.presolve = GNUNET_YES; | ||
1231 | res_mip = mlp_solve_mlp_problem(mlp); | 1245 | res_mip = mlp_solve_mlp_problem(mlp); |
1232 | 1246 | ||
1233 | dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op); | 1247 | dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op); |
@@ -2038,7 +2052,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2038 | mlp->opt_dump_solution_on_fail = GNUNET_NO; | 2052 | mlp->opt_dump_solution_on_fail = GNUNET_NO; |
2039 | 2053 | ||
2040 | mlp->opt_dbg_glpk_verbose = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | 2054 | mlp->opt_dbg_glpk_verbose = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, |
2041 | "ats", "MLP_GLPK_VERBOSE"); | 2055 | "ats", "MLP_DBG_GLPK_VERBOSE"); |
2042 | if (GNUNET_SYSERR == mlp->opt_dbg_glpk_verbose) | 2056 | if (GNUNET_SYSERR == mlp->opt_dbg_glpk_verbose) |
2043 | mlp->opt_dbg_glpk_verbose = GNUNET_NO; | 2057 | mlp->opt_dbg_glpk_verbose = GNUNET_NO; |
2044 | 2058 | ||
@@ -2058,6 +2072,14 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2058 | LOG (GNUNET_ERROR_TYPE_WARNING, | 2072 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2059 | "MLP solver is configured automatically scale the problem!\n"); | 2073 | "MLP solver is configured automatically scale the problem!\n"); |
2060 | 2074 | ||
2075 | mlp->opt_dbg_intopt_presolver = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | ||
2076 | "ats", "MLP_DBG_INTOPT_PRESOLVE"); | ||
2077 | if (GNUNET_SYSERR == mlp->opt_dbg_intopt_presolver) | ||
2078 | mlp->opt_dbg_intopt_presolver = GNUNET_NO; | ||
2079 | if (GNUNET_YES == mlp->opt_dbg_intopt_presolver) | ||
2080 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
2081 | "MLP solver is configured use the mlp presolver\n"); | ||
2082 | |||
2061 | mlp->pv.BIG_M = (double) BIG_M_VALUE; | 2083 | mlp->pv.BIG_M = (double) BIG_M_VALUE; |
2062 | 2084 | ||
2063 | /* Get timeout for iterations */ | 2085 | /* Get timeout for iterations */ |