aboutsummaryrefslogtreecommitdiff
path: root/src/ats/plugin_ats_mlp.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-13 08:34:09 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-13 08:34:09 +0000
commitabcbf9e80d3e702dc225bd4a78a100c14a3826c1 (patch)
tree43a0738c6f3d503bcac43869485b36b5d211043d /src/ats/plugin_ats_mlp.c
parent3e4174aa514058d30647190e44f3dc2e39827dba (diff)
downloadgnunet-abcbf9e80d3e702dc225bd4a78a100c14a3826c1.tar.gz
gnunet-abcbf9e80d3e702dc225bd4a78a100c14a3826c1.zip
extended error messages
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r--src/ats/plugin_ats_mlp.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c
index 251283781..21da08136 100644
--- a/src/ats/plugin_ats_mlp.c
+++ b/src/ats/plugin_ats_mlp.c
@@ -938,27 +938,29 @@ static int
938mlp_solve_lp_problem (struct GAS_MLP_Handle *mlp) 938mlp_solve_lp_problem (struct GAS_MLP_Handle *mlp)
939{ 939{
940 int res = 0; 940 int res = 0;
941 941 int res_status = 0;
942 res = glp_simplex(mlp->p.prob, &mlp->control_param_lp); 942 res = glp_simplex(mlp->p.prob, &mlp->control_param_lp);
943 if (0 == res) 943 if (0 == res)
944 LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem: 0x%02X %s\n", res, mlp_solve_to_string(res)); 944 LOG(GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem: 0x%02X %s\n", res,
945 mlp_solve_to_string (res));
945 else 946 else
946 LOG (GNUNET_ERROR_TYPE_WARNING, "Solving LP problem failed: 0x%02X %s\n", res, mlp_solve_to_string(res)); 947 LOG(GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem failed: 0x%02X %s\n",
948 res, mlp_solve_to_string (res));
947 949
948 /* Analyze problem status */ 950 /* Analyze problem status */
949 res = glp_get_status (mlp->p.prob); 951 res_status = glp_get_status (mlp->p.prob);
950 switch (res) { 952 switch (res_status) {
951 /* solution is optimal */ 953 case GLP_OPT: /* solution is optimal */
952 case GLP_OPT: 954 LOG (GNUNET_ERROR_TYPE_INFO,
953 /* solution is feasible */ 955 "Solving LP problem: 0x%02X %s, 0x%02X %s\n",
954 case GLP_FEAS: 956 res, mlp_solve_to_string(res),
955 LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving LP problem: 0x%02X %s\n", 957 res_status, mlp_status_to_string(res_status));
956 res, mlp_status_to_string(res));
957 return GNUNET_OK; 958 return GNUNET_OK;
958 /* Problem was ill-defined, no way to handle that */
959 default: 959 default:
960 LOG (GNUNET_ERROR_TYPE_WARNING, "Solving LP problem failed, no solution: 0x%02X %s\n", 960 LOG (GNUNET_ERROR_TYPE_WARNING,
961 res, mlp_status_to_string(res)); 961 "Solving LP problem failed: 0x%02X %s 0x%02X %s\n",
962 res, mlp_solve_to_string(res),
963 res_status, mlp_status_to_string(res_status));
962 return GNUNET_SYSERR; 964 return GNUNET_SYSERR;
963 } 965 }
964} 966}
@@ -974,23 +976,28 @@ int
974mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp) 976mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp)
975{ 977{
976 int res = 0; 978 int res = 0;
979 int res_status = 0;
977 res = glp_intopt(mlp->p.prob, &mlp->control_param_mlp); 980 res = glp_intopt(mlp->p.prob, &mlp->control_param_mlp);
978 if (0 == res) 981 if (0 == res)
979 LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving MLP problem: 0x%02X %s\n", res, mlp_solve_to_string(res)); 982 LOG(GNUNET_ERROR_TYPE_DEBUG, "Solving MLP problem: 0x%02X %s\n", res,
983 mlp_solve_to_string (res));
980 else 984 else
981 LOG (GNUNET_ERROR_TYPE_WARNING, "Solving MLP problem failed: 0x%02X %s\n", res, mlp_solve_to_string(res)); 985 LOG(GNUNET_ERROR_TYPE_DEBUG, "Solving MLP problem failed: 0x%02X %s\n", res,
986 mlp_solve_to_string (res));
982 /* Analyze problem status */ 987 /* Analyze problem status */
983 res = glp_mip_status(mlp->p.prob); 988 res_status = glp_mip_status(mlp->p.prob);
984 switch (res) { 989 switch (res_status) {
985 /* solution is optimal */ 990 case GLP_OPT: /* solution is optimal */
986 case GLP_OPT: 991 LOG (GNUNET_ERROR_TYPE_INFO,
987 /* solution is feasible */ 992 "Solving MLP problem: 0x%02X %s, 0x%02X %s\n",
988 case GLP_FEAS: 993 res, mlp_solve_to_string(res),
989 LOG (GNUNET_ERROR_TYPE_DEBUG, "Solving MLP problem: 0x%02X %s\n", res, mlp_status_to_string(res)); 994 res_status, mlp_status_to_string(res_status));
990 return GNUNET_OK; 995 return GNUNET_OK;
991 /* Problem was ill-defined, no way to handle that */
992 default: 996 default:
993 LOG (GNUNET_ERROR_TYPE_WARNING,"Solving MLP problem failed, 0x%02X %s\n\n", res, mlp_status_to_string(res)); 997 LOG (GNUNET_ERROR_TYPE_WARNING,
998 "Solving MLP problem failed: 0x%02X %s 0x%02X %s\n",
999 res, mlp_solve_to_string(res),
1000 res_status, mlp_status_to_string(res_status));
994 return GNUNET_SYSERR; 1001 return GNUNET_SYSERR;
995 } 1002 }
996} 1003}
@@ -1244,6 +1251,8 @@ GAS_mlp_solve_problem (void *solver)
1244 mlp->control_param_mlp.presolve = GNUNET_YES; 1251 mlp->control_param_mlp.presolve = GNUNET_YES;
1245 res_mip = mlp_solve_mlp_problem(mlp); 1252 res_mip = mlp_solve_mlp_problem(mlp);
1246 1253
1254 fprintf (stderr, "%u\n", res_mip);
1255
1247 dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op); 1256 dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op);
1248 dur_total = GNUNET_TIME_absolute_get_duration (start_total); 1257 dur_total = GNUNET_TIME_absolute_get_duration (start_total);
1249 1258
@@ -1256,13 +1265,12 @@ GAS_mlp_solve_problem (void *solver)
1256 /* Do not execute mip solver since lp solution is invalid */ 1265 /* Do not execute mip solver since lp solution is invalid */
1257 dur_mlp = GNUNET_TIME_UNIT_ZERO; 1266 dur_mlp = GNUNET_TIME_UNIT_ZERO;
1258 dur_total = GNUNET_TIME_absolute_get_duration (start_total); 1267 dur_total = GNUNET_TIME_absolute_get_duration (start_total);
1259 //GNUNET_break(0); 1268
1260 notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, GAS_STAT_FAIL, 1269 notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, GAS_STAT_FAIL,
1261 (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); 1270 (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
1262 res_mip = GNUNET_SYSERR; 1271 res_mip = GNUNET_SYSERR;
1263 } 1272 }
1264 1273
1265
1266 /* Notify about end */ 1274 /* Notify about end */
1267 notify(mlp, GAS_OP_SOLVE_STOP, 1275 notify(mlp, GAS_OP_SOLVE_STOP,
1268 ((GNUNET_OK == res_mip) && (GNUNET_OK == res_mip)) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, 1276 ((GNUNET_OK == res_mip) && (GNUNET_OK == res_mip)) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,