aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-01-19 13:12:30 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-01-19 13:12:30 +0000
commite409add63ba2648f330ab4080d1d62947bda9cf7 (patch)
treea295d1092c78e0f2bb70d73777ce2cf12be00476 /src/ats
parent1df3690d0e3503a1bf3a7ecabd2fa3ba0e16ed0a (diff)
downloadgnunet-e409add63ba2648f330ab4080d1d62947bda9cf7.tar.gz
gnunet-e409add63ba2648f330ab4080d1d62947bda9cf7.zip
- using DBL_MAX as VERY_BIG_VALUE makes problem unscalable
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c
index 78bb5f21a..2d07a4069 100644
--- a/src/ats/gnunet-service-ats_addresses_mlp.c
+++ b/src/ats/gnunet-service-ats_addresses_mlp.c
@@ -30,12 +30,11 @@
30#include "gnunet-service-ats_addresses_mlp.h" 30#include "gnunet-service-ats_addresses_mlp.h"
31#include "gnunet_statistics_service.h" 31#include "gnunet_statistics_service.h"
32#include "glpk.h" 32#include "glpk.h"
33#include "float.h"
34 33
35#define WRITE_MLP GNUNET_YES 34#define WRITE_MLP GNUNET_YES
36#define DEBUG_ATS GNUNET_YES 35#define DEBUG_ATS GNUNET_YES
37/* A very big value */ 36/* A very big value (~1 TB/s)*/
38#define M DBL_MAX 37#define M 1100000000000
39 38
40/** 39/**
41 * Translate glpk solver error codes to text 40 * Translate glpk solver error codes to text
@@ -247,7 +246,6 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
247 mlpi->r_c1 = row_index; 246 mlpi->r_c1 = row_index;
248 /* set row bounds: <= 0 */ 247 /* set row bounds: <= 0 */
249 glp_set_row_bnds (mlp->prob, row_index, GLP_UP, 0.0, 0.0); 248 glp_set_row_bnds (mlp->prob, row_index, GLP_UP, 0.0, 0.0);
250
251 mlp->ia[mlp->ci] = row_index; 249 mlp->ia[mlp->ci] = row_index;
252 mlp->ja[mlp->ci] = mlpi->c_b; 250 mlp->ja[mlp->ci] = mlpi->c_b;
253 mlp->ar[mlp->ci] = 1; 251 mlp->ar[mlp->ci] = 1;
@@ -266,6 +264,9 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
266 mlpi->r_c3 = row_index; 264 mlpi->r_c3 = row_index;
267 /* set row bounds: >= 0 */ 265 /* set row bounds: >= 0 */
268 glp_set_row_bnds (mlp->prob, row_index, GLP_LO, 0.0, 0.0); 266 glp_set_row_bnds (mlp->prob, row_index, GLP_LO, 0.0, 0.0);
267 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
268 "ats-mlp",
269 "!!!!! bmin %i\n", mlp->b_min);
269 270
270 mlp->ia[mlp->ci] = row_index; 271 mlp->ia[mlp->ci] = row_index;
271 mlp->ja[mlp->ci] = mlpi->c_b; 272 mlp->ja[mlp->ci] = mlpi->c_b;
@@ -274,7 +275,8 @@ create_constraint_it (void *cls, const GNUNET_HashCode * key, void *value)
274 275
275 mlp->ia[mlp->ci] = row_index; 276 mlp->ia[mlp->ci] = row_index;
276 mlp->ja[mlp->ci] = mlpi->c_n; 277 mlp->ja[mlp->ci] = mlpi->c_n;
277 mlp->ar[mlp->ci] = -mlp->b_min; 278 mlp->ar[mlp->ci] = -64000;
279 //mlp->ar[mlp->ci] = -mlp->b_min;
278 mlp->ci++; 280 mlp->ci++;
279#if 0 281#if 0
280 /* c 4) minimum connections 282 /* c 4) minimum connections
@@ -356,7 +358,7 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON
356 358
357 int pi = ((7 * n_addresses) /*+ (2 * n_addresses + mlp->m_q + 1)*/); 359 int pi = ((7 * n_addresses) /*+ (2 * n_addresses + mlp->m_q + 1)*/);
358 mlp->cm_size = pi; 360 mlp->cm_size = pi;
359 mlp->ci = 0; 361 mlp->ci = 1;
360 362
361 /* row index */ 363 /* row index */
362 int *ia = GNUNET_malloc (pi * sizeof (int)); 364 int *ia = GNUNET_malloc (pi * sizeof (int));
@@ -535,10 +537,6 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_MultiHas
535 /* Set optimization direction to maximize */ 537 /* Set optimization direction to maximize */
536 glp_set_obj_dir (mlp->prob, GLP_MAX); 538 glp_set_obj_dir (mlp->prob, GLP_MAX);
537 539
538 /* Setting initial index == 1
539 * glpk matrix is from 1 .. number_elements*/
540
541 mlp->ci = 1;
542 /* Adding invariant columns */ 540 /* Adding invariant columns */
543 541
544 /* Diversity d column */ 542 /* Diversity d column */