From 30b89ef65bc58d71f6edb823c40d77a01e2c3f36 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Thu, 19 Jan 2012 13:49:17 +0000 Subject: [PATCH] - fixed problem with b_min double conversion BIG_M is now UINT32_MAX since assigned bandwidth cannot be bigger --- src/ats/gnunet-service-ats_addresses_mlp.c | 17 +++++------------ src/ats/gnunet-service-ats_addresses_mlp.h | 2 ++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index 2d07a4069..798d8edc6 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c @@ -33,8 +33,6 @@ #define WRITE_MLP GNUNET_YES #define DEBUG_ATS GNUNET_YES -/* A very big value (~1 TB/s)*/ -#define M 1100000000000 /** * Translate glpk solver error codes to text @@ -253,7 +251,7 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value) mlp->ia[mlp->ci] = row_index; mlp->ja[mlp->ci] = mlpi->c_n; - mlp->ar[mlp->ci] = -M; + mlp->ar[mlp->ci] = -mlp->BIG_M; mlp->ci++; /* c 3) minimum bandwidth @@ -264,9 +262,7 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value) mlpi->r_c3 = row_index; /* set row bounds: >= 0 */ glp_set_row_bnds (mlp->prob, row_index, GLP_LO, 0.0, 0.0); - GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, - "ats-mlp", - "!!!!! bmin %i\n", mlp->b_min); + GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "ats-mlp", "bmin %i %f\n", mlp->b_min, mlp->BIG_M); mlp->ia[mlp->ci] = row_index; mlp->ja[mlp->ci] = mlpi->c_b; @@ -275,8 +271,7 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value) mlp->ia[mlp->ci] = row_index; mlp->ja[mlp->ci] = mlpi->c_n; - mlp->ar[mlp->ci] = -64000; - //mlp->ar[mlp->ci] = -mlp->b_min; + mlp->ar[mlp->ci] = - (double) mlp->b_min; mlp->ci++; #if 0 /* c 4) minimum connections @@ -480,10 +475,6 @@ create_columns_it (void *cls, const GNUNET_HashCode * key, void *value) mlpi->c_b = col; mlpi->c_n = col + 1; - GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, - "ats-mlp", - "Culoumn %i %i\n", mlpi->c_b, mlpi->c_n); - GNUNET_asprintf (&name, "b_%s_%s", GNUNET_i2s (&address->peer), address->plugin); glp_set_col_name (mlp->prob, mlpi->c_b , name); GNUNET_free (name); @@ -1002,6 +993,8 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, mlp->last_execution = GNUNET_TIME_absolute_get_forever(); + + mlp->BIG_M = (double) UINT32_MAX; mlp->co_D = D; mlp->co_R = R; mlp->co_U = U; diff --git a/src/ats/gnunet-service-ats_addresses_mlp.h b/src/ats/gnunet-service-ats_addresses_mlp.h index f41553940..f1a045dda 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.h +++ b/src/ats/gnunet-service-ats_addresses_mlp.h @@ -72,6 +72,8 @@ struct GAS_MLP_Handle void *prob; #endif + double BIG_M; + /** * GLPK LP control parameter */ -- 2.25.1