aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-01-19 13:49:17 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-01-19 13:49:17 +0000
commit30b89ef65bc58d71f6edb823c40d77a01e2c3f36 (patch)
tree41b3e8194c32e3eb649509fda57e4075340c2733 /src/ats
parente409add63ba2648f330ab4080d1d62947bda9cf7 (diff)
downloadgnunet-30b89ef65bc58d71f6edb823c40d77a01e2c3f36.tar.gz
gnunet-30b89ef65bc58d71f6edb823c40d77a01e2c3f36.zip
- fixed problem with b_min double conversion
BIG_M is now UINT32_MAX since assigned bandwidth cannot be bigger
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.c17
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.h2
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 @@
33 33
34#define WRITE_MLP GNUNET_YES 34#define WRITE_MLP GNUNET_YES
35#define DEBUG_ATS GNUNET_YES 35#define DEBUG_ATS GNUNET_YES
36/* A very big value (~1 TB/s)*/
37#define M 1100000000000
38 36
39/** 37/**
40 * Translate glpk solver error codes to text 38 * Translate glpk solver error codes to text
@@ -253,7 +251,7 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
253 251
254 mlp->ia[mlp->ci] = row_index; 252 mlp->ia[mlp->ci] = row_index;
255 mlp->ja[mlp->ci] = mlpi->c_n; 253 mlp->ja[mlp->ci] = mlpi->c_n;
256 mlp->ar[mlp->ci] = -M; 254 mlp->ar[mlp->ci] = -mlp->BIG_M;
257 mlp->ci++; 255 mlp->ci++;
258 256
259 /* c 3) minimum bandwidth 257 /* c 3) minimum bandwidth
@@ -264,9 +262,7 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
264 mlpi->r_c3 = row_index; 262 mlpi->r_c3 = row_index;
265 /* set row bounds: >= 0 */ 263 /* set row bounds: >= 0 */
266 glp_set_row_bnds (mlp->prob, row_index, GLP_LO, 0.0, 0.0); 264 glp_set_row_bnds (mlp->prob, row_index, GLP_LO, 0.0, 0.0);
267 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 265 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "ats-mlp", "bmin %i %f\n", mlp->b_min, mlp->BIG_M);
268 "ats-mlp",
269 "!!!!! bmin %i\n", mlp->b_min);
270 266
271 mlp->ia[mlp->ci] = row_index; 267 mlp->ia[mlp->ci] = row_index;
272 mlp->ja[mlp->ci] = mlpi->c_b; 268 mlp->ja[mlp->ci] = mlpi->c_b;
@@ -275,8 +271,7 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
275 271
276 mlp->ia[mlp->ci] = row_index; 272 mlp->ia[mlp->ci] = row_index;
277 mlp->ja[mlp->ci] = mlpi->c_n; 273 mlp->ja[mlp->ci] = mlpi->c_n;
278 mlp->ar[mlp->ci] = -64000; 274 mlp->ar[mlp->ci] = - (double) mlp->b_min;
279 //mlp->ar[mlp->ci] = -mlp->b_min;
280 mlp->ci++; 275 mlp->ci++;
281#if 0 276#if 0
282 /* c 4) minimum connections 277 /* c 4) minimum connections
@@ -480,10 +475,6 @@ create_columns_it (void *cls, const GNUNET_HashCode * key, void *value)
480 mlpi->c_b = col; 475 mlpi->c_b = col;
481 mlpi->c_n = col + 1; 476 mlpi->c_n = col + 1;
482 477
483 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
484 "ats-mlp",
485 "Culoumn %i %i\n", mlpi->c_b, mlpi->c_n);
486
487 GNUNET_asprintf (&name, "b_%s_%s", GNUNET_i2s (&address->peer), address->plugin); 478 GNUNET_asprintf (&name, "b_%s_%s", GNUNET_i2s (&address->peer), address->plugin);
488 glp_set_col_name (mlp->prob, mlpi->c_b , name); 479 glp_set_col_name (mlp->prob, mlpi->c_b , name);
489 GNUNET_free (name); 480 GNUNET_free (name);
@@ -1002,6 +993,8 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1002 993
1003 mlp->last_execution = GNUNET_TIME_absolute_get_forever(); 994 mlp->last_execution = GNUNET_TIME_absolute_get_forever();
1004 995
996
997 mlp->BIG_M = (double) UINT32_MAX;
1005 mlp->co_D = D; 998 mlp->co_D = D;
1006 mlp->co_R = R; 999 mlp->co_R = R;
1007 mlp->co_U = U; 1000 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
72 void *prob; 72 void *prob;
73#endif 73#endif
74 74
75 double BIG_M;
76
75 /** 77 /**
76 * GLPK LP control parameter 78 * GLPK LP control parameter
77 */ 79 */