gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r26180 - gnunet/src/ats
Date: Thu, 21 Feb 2013 16:50:22 +0100

Author: wachs
Date: 2013-02-21 16:50:22 +0100 (Thu, 21 Feb 2013)
New Revision: 26180

Modified:
   gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
   gnunet/src/ats/gnunet-service-ats_addresses_mlp.h
Log:
auto_solve


Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c   2013-02-21 15:12:21 UTC 
(rev 26179)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c   2013-02-21 15:50:22 UTC 
(rev 26180)
@@ -554,7 +554,6 @@
 
 /**
  * Add constraints that are iterating over "forall addresses"
- * and collects all existing peers for "forall peers" constraints
  *
  * @param cls GAS_MLP_Handle
  * @param key Hashcode
@@ -568,6 +567,7 @@
   struct GAS_MLP_Handle *mlp = cls;
   struct MLP_Problem *p = &mlp->p;
   struct ATS_Address *address = value;
+  struct ATS_Peer *peer = NULL;
   struct MLP_information *mlpi;
   unsigned int row_index;
   char *name;
@@ -576,6 +576,16 @@
   if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(mlp->peers, key))
        return GNUNET_OK;
 
+  /* Get peer */
+  peer = GNUNET_CONTAINER_multihashmap_get (mlp->peers, key);
+  GNUNET_assert (NULL != peer);
+  if (GNUNET_NO == peer->processed)
+  {
+               /* Adding constraints for peer */
+               peer->processed = GNUNET_YES;
+  }
+
+
   GNUNET_assert (address->solver_information != NULL);
   mlpi = (struct MLP_information *) address->solver_information;
 
@@ -845,13 +855,13 @@
   {
     p->r_quota[c] = glp_add_rows (p->prob, 1);
     char * text;
-    GNUNET_asprintf(&text, "quota_ats_%i", mlp->pv.quota_index[c]);
+    GNUNET_asprintf(&text, "quota_ats_%s", 
GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]));
     glp_set_row_name (p->prob, p->r_quota[c], text);
     /* Set bounds to 0 <= x <= quota_out */
     glp_set_row_bnds (p->prob, p->r_quota[c], GLP_UP, 0.0, 
mlp->pv.quota_out[c]);
 #if  DEBUG_MLP_PROBLEM_CREATION
                LOG (GNUNET_ERROR_TYPE_DEBUG, "[P]: Added row [%u] `%s': %s 
%u\n",
-                               p->r_quota[c], name,
+                               p->r_quota[c], text,
                                "<=", mlp->pv.quota_out[c]);
 #endif
     GNUNET_free (text);
@@ -1584,7 +1594,8 @@
        LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' with 
address request \n", GNUNET_i2s(&address->peer));
        /* Problem size changed: new address for peer with pending request */
        mlp->mlp_prob_changed = GNUNET_YES;
-       GAS_mlp_solve_problem (solver, addresses);
+       if (GNUNET_YES == mlp->mlp_auto_solve)
+               GAS_mlp_solve_problem (solver, addresses);
 }
 
 /**
@@ -1633,7 +1644,8 @@
 
        /* Problem size changed: new address for peer with pending request */
        mlp->mlp_prob_updated = GNUNET_YES;
-       GAS_mlp_solve_problem (solver, addresses);
+       if (GNUNET_YES == mlp->mlp_auto_solve)
+               GAS_mlp_solve_problem (solver, addresses);
   return;
 
 #if 0
@@ -1765,7 +1777,8 @@
 
        /* Problem size changed: new address for peer with pending request */
        mlp->mlp_prob_changed = GNUNET_YES;
-       GAS_mlp_solve_problem (solver, addresses);
+       if (GNUNET_YES == mlp->mlp_auto_solve)
+               GAS_mlp_solve_problem (solver, addresses);
   return;
 
 #if 0
@@ -2200,7 +2213,7 @@
   mlp->pv.m_q = GNUNET_ATS_QualityPropertiesCount;
   mlp->mlp_prob_changed = GNUNET_NO;
   mlp->mlp_prob_updated = GNUNET_NO;
-
+  mlp->mlp_auto_solve = GNUNET_YES;
   mlp->peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
 
   /* Setup GLPK */

Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.h   2013-02-21 15:12:21 UTC 
(rev 26179)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.h   2013-02-21 15:50:22 UTC 
(rev 26180)
@@ -258,6 +258,14 @@
   int mlp_prob_changed;
 
 
+  /**
+   * Solve the problem automatically when updates occur?
+   * Default: GNUNET_YES
+   * Can be disabled for test and measurements
+   */
+  int mlp_auto_solve;
+
+
 #if 0
   /**
    * Interval between scheduled problem solving
@@ -274,12 +282,6 @@
    */
   unsigned int max_iterations;
 
-  /**
-   * Solve the problem automatically when updates occur?
-   * Default: GNUNET_YES
-   * Can be disabled for test and measurements
-   */
-  int auto_solve;
 
   /**
    * Is a solution attemp running?




reply via email to

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