struct ATS_peer * peers;
+ /**
+ * Use built-in MLP presolver or simplex
+ */
+ int builtin_mlp_presolver;
+
/**
* Maximum number of LP iterations per calculation
*/
}
return cont;
}
-
+#endif
static void ats_solve_problem (unsigned int max_it, unsigned int max_dur, unsigned int c_peers, unsigned int c_mechs, struct ATS_stat *stat)
{
int solution;
// Solving simplex
- glp_prob *prob = ats->prob;
-
- glp_smcp opt_lp;
- glp_init_smcp(&opt_lp);
-
+ if (ats->builtin_mlp_presolver == GNUNET_NO)
+ {
+ glp_smcp opt_lp;
+ glp_init_smcp(&opt_lp);
#if VERBOSE_ATS
opt_lp.msg_lev = GLP_MSG_ALL;
#else
opt_lp.msg_lev = GLP_MSG_OFF;
#endif
- //opt_lp.presolve = GLP_ON;
- result = glp_simplex(prob, &opt_lp);
- solution = glp_get_status (prob);
-
- if (GNUNET_YES == ats_evaluate_results(result, solution, "LP"))
+ result = glp_simplex(ats->prob, &opt_lp);
+ solution = glp_get_status (ats->prob);
+ }
+ if (((ats->builtin_mlp_presolver == GNUNET_NO) && (GNUNET_YES == ats_evaluate_results(result, solution, "LP"))) || (ats->builtin_mlp_presolver == GNUNET_YES))
{
/* Solving mlp */
glp_iocp opt_mlp;
glp_init_iocp(&opt_mlp);
/* maximum duration */
- //opt_mlp.presolve = GLP_ON;
+ if (ats->builtin_mlp_presolver == GNUNET_YES)
+ opt_mlp.presolve = GLP_ON;
opt_mlp.tm_lim = max_dur;
/* output level */
#if VERBOSE_ATS
#else
opt_mlp.msg_lev = GLP_MSG_OFF;
#endif
- result = glp_intopt (prob, &opt_mlp);
- solution = glp_mip_status (prob);
+ result = glp_intopt (ats->prob, &opt_mlp);
+ solution = glp_mip_status (ats->prob);
stat->solution = solution;
stat->valid = GNUNET_NO;
if (ats_evaluate_results(result, solution, "MLP") == GNUNET_YES)
stat->valid = GNUNET_YES;
- /* done */
}
/*
}
#endif
}
-
+#if HAVE_LIBGLPK
static void ats_delete_problem ()
{
int c;
if (GNUNET_CONFIGURATION_have_value(cfg, "transport", "DUMP_SOLUTION"))
ats->save_solution = GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport","DUMP_SOLUTION");
+ ats->builtin_mlp_presolver = GNUNET_YES;
+ if (GNUNET_CONFIGURATION_have_value(cfg, "transport", "BUILTIN_PRESOLVER"))
+ {
+ ats->builtin_mlp_presolver = GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport","BUILTIN_PRESOLVER");
+ }
+
ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation, ats);
}