From: Matthias Wachs Date: Wed, 30 Mar 2011 08:29:05 +0000 (+0000) Subject: more ats X-Git-Tag: initial-import-from-subversion-38251~18864 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=75ef8c5ffc0b0a70a8e2ac40c2a85e43e2348a78;p=oweals%2Fgnunet.git more ats --- diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 5ca9d0c99..995ba253c 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -5593,6 +5593,7 @@ static int ats_create_problem (int max_it, int max_dur ) int c_peers = 0; int c_mechs = 0; int result; + int solution; int c_c_ressources = 0; int c_q_metrics = 0; @@ -5856,22 +5857,20 @@ static int ats_create_problem (int max_it, int max_dur ) glp_load_matrix(prob, array_index-1, ia, ja, ar); - /* Solve the LP problem */ - glp_smcp opt ; - glp_init_smcp(&opt); + glp_iocp opt; + glp_init_iocp(&opt); - /* maximum iterations */ - opt.it_lim = max_it; + /* Use LP presolver (if not, valid LP solution has to be provided)*/ + opt.presolve =GLP_ON; /* maximum duration */ opt.tm_lim = max_dur; - opt.presolve = GLP_ON; /* output level */ - if (DEBUG_ATS) + if (VERBOSE_ATS) opt.msg_lev = GLP_MSG_ALL; else opt.msg_lev = GLP_MSG_OFF; - - result = glp_simplex(prob, &opt); + result = glp_intopt (prob, &opt); + solution = glp_mip_status (prob); switch (result) { case GLP_ESTOP : /* search terminated by application */ @@ -5908,10 +5907,28 @@ static int ats_create_problem (int max_it, int max_dur ) break; default: - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Optimal solution\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Problem has been solved\n"); break; } + switch (solution) { + case GLP_UNDEF: + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MIP solution is undefined\n"); + break; + case GLP_OPT: + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MIP solution is integer optimal\n"); + break; + case GLP_FEAS: + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MIP solution is integer feasible, however, its optimality (or non-optimality) has not been proven, \n"); + break; + case GLP_NOFEAS: + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MI problem has no integer feasible solution\n"); + break; + break; + default: + break; + } + char * debug_solution = NULL; char * old = NULL; for (c=1; c<= 2*c_mechs; c++ )