[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19876 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19876 - gnunet/src/ats |
Date: |
Mon, 20 Feb 2012 21:45:19 +0100 |
Author: wachs
Date: 2012-02-20 21:45:19 +0100 (Mon, 20 Feb 2012)
New Revision: 19876
Modified:
gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
gnunet/src/ats/test_ats_mlp.c
Log:
- choosing BIG_M and default quota is crucial to get a solvable constraint
system (hours of debugging!)
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-02-20 18:25:35 UTC
(rev 19875)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-02-20 20:45:19 UTC
(rev 19876)
@@ -35,6 +35,8 @@
#define DEBUG_ATS GNUNET_NO
#define VERBOSE_GLPK GNUNET_NO
+#define ENABLE_C8 GNUNET_YES
+#define ENABLE_C9 GNUNET_YES
/**
* Translate glpk solver error codes to text
* @param retcode return code
@@ -577,6 +579,7 @@
glp_set_row_bnds (mlp->prob, peer->r_c2, GLP_FX, 1.0, 1.0);
/* Adding rows for c 9) */
+#if ENABLE_C9
peer->r_c9 = glp_add_rows (mlp->prob, 1);
GNUNET_asprintf(&name, "c9_%s", GNUNET_i2s(&peer->id));
glp_set_row_name (mlp->prob, peer->r_c9, name);
@@ -589,9 +592,8 @@
ja[mlp->ci] = mlp->c_r;
ar[mlp->ci] = -1;
mlp->ci++;
+#endif
-
-
while (addr != NULL)
{
mlpi = (struct MLP_information *) addr->mlp_information;
@@ -609,11 +611,13 @@
ar[mlp->ci] = peer->f;
mlp->ci++;
+#if ENABLE_C9
/* coefficient for c 9) */
ia[mlp->ci] = peer->r_c9;
ja[mlp->ci] = mlpi->c_b;
ar[mlp->ci] = 1;
mlp->ci++;
+#endif
addr = addr->next;
}
@@ -782,6 +786,7 @@
/* Column lower bound = 0.0 */
glp_set_col_bnds (mlp->prob, col, GLP_LO, 0.0, 0.0);
+#if ENABLE_C9
/* Relativity r column */
col = glp_add_cols (mlp->prob, 1);
mlp->c_r = col;
@@ -791,6 +796,7 @@
glp_set_obj_coef (mlp->prob, col, mlp->co_R);
/* Column lower bound = 0.0 */
glp_set_col_bnds (mlp->prob, col, GLP_LO, 0.0, 0.0);
+#endif
/* Quality metric columns */
col = glp_add_cols(mlp->prob, mlp->m_q);
@@ -1131,6 +1137,8 @@
mlp->prob = glp_create_prob();
GNUNET_assert (mlp->prob != NULL);
+ mlp->BIG_M = (double) (UINT32_MAX) /10;
+
/* Get diversity coefficient from configuration */
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
"COEFFICIENT_D",
@@ -1244,11 +1252,11 @@
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
entry_out, "a_out))
{
- quota_out = UINT32_MAX;
+ quota_out = mlp->BIG_M;
}
if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
entry_in, "a_in))
{
- quota_in = UINT32_MAX;
+ quota_in = mlp->BIG_M;
}
/* Check if defined quota could make problem unsolvable */
if ((n_min * b_min) > quota_out)
@@ -1315,8 +1323,6 @@
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;
Modified: gnunet/src/ats/test_ats_mlp.c
===================================================================
--- gnunet/src/ats/test_ats_mlp.c 2012-02-20 18:25:35 UTC (rev 19875)
+++ gnunet/src/ats/test_ats_mlp.c 2012-02-20 20:45:19 UTC (rev 19876)
@@ -94,10 +94,10 @@
addr[0].peer.hashPubKey = p[0].hashPubKey;
struct GNUNET_ATS_Information a1_ats[3];
set_ats (&a1_ats[0], GNUNET_ATS_QUALITY_NET_DISTANCE, 1);
- set_ats (&a1_ats[1], GNUNET_ATS_QUALITY_NET_DELAY, 32);
+ set_ats (&a1_ats[1], GNUNET_ATS_QUALITY_NET_DELAY, 2);
set_ats (&a1_ats[2], GNUNET_ATS_ARRAY_TERMINATOR, 0);
create_address (&addr[0], "dummy", 3, &a1_ats[0]);
- addr[0].atsp_network_type = GNUNET_ATS_NET_WAN;
+ addr[0].atsp_network_type = GNUNET_ATS_NET_LOOPBACK;
/* Creating peer 1 address 2 */
@@ -107,7 +107,7 @@
set_ats (&a2_ats[1], GNUNET_ATS_QUALITY_NET_DISTANCE, 1);
set_ats (&a2_ats[2], GNUNET_ATS_ARRAY_TERMINATOR, 0);
create_address (&addr[1], "dummy2", 3, &a2_ats[0]);
- addr[1].atsp_network_type = GNUNET_ATS_NET_WAN;
+ addr[1].atsp_network_type = GNUNET_ATS_NET_LAN;
/* Creating peer 2 address 1 */
addr[2].peer.hashPubKey = p[1].hashPubKey;
@@ -116,7 +116,7 @@
set_ats (&a3_ats[1], GNUNET_ATS_QUALITY_NET_DISTANCE, 1);
set_ats (&a3_ats[2], GNUNET_ATS_ARRAY_TERMINATOR, 0);
create_address (&addr[2], "dummy3", 3, &a3_ats[0]);
- addr[2].atsp_network_type = GNUNET_ATS_NET_LAN;
+ addr[2].atsp_network_type = GNUNET_ATS_NET_WAN;
GNUNET_CONTAINER_multihashmap_put(addresses, &addr[0].peer.hashPubKey,
&addr[0], GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19876 - gnunet/src/ats,
gnunet <=