gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26199 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r26199 - gnunet/src/ats
Date: Mon, 25 Feb 2013 11:43:05 +0100

Author: wachs
Date: 2013-02-25 11:43:04 +0100 (Mon, 25 Feb 2013)
New Revision: 26199

Modified:
   gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
   gnunet/src/ats/test_ats_mlp.c
Log:
fixes


Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c   2013-02-25 10:02:21 UTC 
(rev 26198)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c   2013-02-25 10:43:04 UTC 
(rev 26199)
@@ -931,7 +931,7 @@
    * b_t  + (-M) * n_t <= 0
    * */
   GNUNET_asprintf(&name, "c1_%s_%s", GNUNET_i2s(&address->peer), 
address->plugin);
-  mlpi->r_c1 = mlp_create_problem_create_constraint (p, name, GLP_LO, 0.0, 
0.0);
+  mlpi->r_c1 = mlp_create_problem_create_constraint (p, name, GLP_UP, 0.0, 
0.0);
        GNUNET_free (name);
 
        /*  c1) set b = 1 coefficient */
@@ -949,7 +949,7 @@
        /*  c3) set b = 1 coefficient */
        mlp_create_problem_set_value (p, mlpi->r_c3, mlpi->c_b, 1, __LINE__);
        /*  c3) set n = -b_min coefficient */
-       mlp_create_problem_set_value (p, mlpi->r_c3, mlpi->c_n, -mlp->pv.b_min, 
__LINE__);
+       mlp_create_problem_set_value (p, mlpi->r_c3, mlpi->c_n, - ((double 
)mlp->pv.b_min), __LINE__);
 
 
        /* Set coefficient entries in invariant rows */
@@ -979,23 +979,7 @@
   /* c 7) Optimize quality */
   /* For all quality metrics, set quality of this address */
   for (c = 0; c < mlp->pv.m_q; c++)
-  {
-#if 0
-      mlpi = ta->solver_information;
-      value = mlpi->q_averaged[c];
-
-      mlpi->r_q[c] = p->r_q[c];
-
-      ia[p->ci] = p->r_q[c];
-      ja[p->ci] = mlpi->c_b;
-      ar[p->ci] = tp->f_q[c] * value;
-#if  DEBUG_MLP_PROBLEM_CREATION
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "[P]: Set value [%u,%u] ==  %.2f\n",
-               p->ia[p->ci], p->ja[p->ci], p->ar[p->ci]);
-#endif
-#endif
        mlp_create_problem_set_value (p, p->r_q[c], mlpi->c_b, 
mlpi->q_averaged[c], __LINE__);
-  }
 
 
   return GNUNET_OK;
@@ -1024,7 +1008,7 @@
   for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
   {
       char * text;
-      GNUNET_asprintf(&text, "quota_ats_%s", 
GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]));
+      GNUNET_asprintf(&text, "c10_quota_ats_%s", 
GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]));
                p->r_quota[c] = mlp_create_problem_create_constraint (p, text, 
GLP_DB, 0.0, mlp->pv.quota_out[c]);
                GNUNET_free (text);
   }
@@ -1102,6 +1086,7 @@
   p->num_elements = (10 * p->num_addresses + mlp->pv.m_q * p->num_addresses +  
mlp->pv.m_q + p->num_peers + 2 + 1);
        LOG (GNUNET_ERROR_TYPE_DEBUG, "Rebuilding problem for %u peer(s) and %u 
addresse(s) and %u quality metrics == %u elements\n",
                        p->num_peers, p->num_addresses, mlp->pv.m_q, 
p->num_elements);
+       LOG (GNUNET_ERROR_TYPE_DEBUG, "Rebuilding %u \n", mlp->pv.b_min);
 
   /* Set a problem name */
   glp_set_prob_name (p->prob, "GNUnet ATS bandwidth distribution");
@@ -1324,6 +1309,14 @@
                        (unsigned long long) duration_lp.rel_value,
                        (unsigned long long) duration_mlp.rel_value);
 
+       /* Store LP */
+#if DUMP_PROBLEM
+       char *filename;
+       GNUNET_asprintf (&filename, "problem_%llu.lp", 
GNUNET_TIME_absolute_get().abs_value);
+       glp_write_lp (mlp->p.prob, 0, filename);
+       GNUNET_free (filename);
+#endif
+
        /* Propagate result*/
        if (GNUNET_OK == res)
        {

Modified: gnunet/src/ats/test_ats_mlp.c
===================================================================
--- gnunet/src/ats/test_ats_mlp.c       2013-02-25 10:02:21 UTC (rev 26198)
+++ gnunet/src/ats/test_ats_mlp.c       2013-02-25 10:43:04 UTC (rev 26199)
@@ -201,7 +201,7 @@
   }
 
   /* Create address 3 */
-  address[2] = create_address (&p[1], "test_plugin", "test_addr2", 
strlen("test_addr2")+1, 0);
+  address[2] = create_address (&p[1], "test_plugin2", "test_addr2", 
strlen("test_addr2")+1, 0);
   if (NULL == address[2])
   {
        GNUNET_break (0);
@@ -217,7 +217,7 @@
 
 
   /* Create address 0 */
-  address[0] = create_address (&p[0], "test_plugin", "test_addr0", 
strlen("test_addr0")+1, 0);
+  address[0] = create_address (&p[0], "test_plugin0", "test_addr0", 
strlen("test_addr0")+1, 0);
   if (NULL == address[0])
   {
        GNUNET_break (0);
@@ -240,7 +240,7 @@
   GAS_mlp_get_preferred_address (mlp, addresses, &p[0]);
 
   /* Create address 1 */
-  address[1] = create_address (&p[0], "test_plugin", "test_addr1", 
strlen("test_addr1")+1, 0);
+  address[1] = create_address (&p[0], "test_plugin1", "test_addr1", 
strlen("test_addr1")+1, 0);
   if (NULL == address[1])
   {
        GNUNET_break (0);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]