int t;
};
-#define DEBUG_ATS GNUNET_YES
-#define VERBOSE_ATS GNUNET_YES
-
-
-static int ats_create_problem (int max_it, int max_dur )
+#define DEBUG_ATS GNUNET_NO
+#define VERBOSE_ATS GNUNET_NO
+
+/** solve the bandwidth distribution problem
+ * @param max_it maximum iterations
+ * @param max_dur maximum duration in ms
+ * @param D weight for diversity
+ * @param U weight for utility
+ * @param R weight for relativity
+ * @param v_b_min minimal bandwidth per peer
+ * @param v_n_min minimum number of connections
+ * @return GNUNET_SYSERR if glpk is not available, number of mechanisms used
+ */
+static int ats_create_problem (int max_it, int max_dur , double D, double U, double R, int v_b_min, int v_n_min)
{
#if !HAVE_LIBGLPK
if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "no glpk installed\n");
- return -1;
+ return GNUNET_SYSERR;
#else
if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "glpk installed\n");
-#endif
+
glp_prob *prob;
int c;
int c_c_ressources = 0;
int c_q_metrics = 0;
- double v_b_min = 100;
- double v_n_min = 1;
-
//double M = 10000000000; // ~10 GB
double M = 1000;
- // This are values that are later set from extern
- double D = 1;
- double U = 1;
- double R = 1;
-
double Q[c_q_metrics+1];
for (c=1; c<=c_q_metrics; c++)
{
GNUNET_free(peers);
return c_mechs;
+#endif
}
/* To remove: just for testing */
if (glpk==GNUNET_YES)
{
start = GNUNET_TIME_absolute_get();
- c_mechs = ats_create_problem(5000,5000);
+ c_mechs = ats_create_problem(5000, 5000, 1.0, 1.0, 1.0, 1000, 5);
if (c_mechs >= 0)
{
duration = GNUNET_TIME_absolute_get_difference(start,GNUNET_TIME_absolute_get());