gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33247 - gnunet/src/ats
Date: Mon, 12 May 2014 18:47:50 +0200

Author: wachs
Date: 2014-05-12 18:47:50 +0200 (Mon, 12 May 2014)
New Revision: 33247

Modified:
   gnunet/src/ats/perf_ats_solver.c
   gnunet/src/ats/perf_ats_solver.conf
   gnunet/src/ats/plugin_ats_mlp.c
Log:
fixes for the solver and perf tool


Modified: gnunet/src/ats/perf_ats_solver.c
===================================================================
--- gnunet/src/ats/perf_ats_solver.c    2014-05-12 15:55:41 UTC (rev 33246)
+++ gnunet/src/ats/perf_ats_solver.c    2014-05-12 16:47:50 UTC (rev 33247)
@@ -370,29 +370,36 @@
 perf_update_address (struct ATS_Address *cur)
 {
   int r_type;
-  int r_val;
+  int abs_val;
+  double rel_val;
 
   r_type = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2);
   switch (r_type)
   {
   case 0:
-    r_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
-    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-        "Updating peer `%s' address %p type %s val %u\n",
-        GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DELAY", r_val);
+    abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
+    rel_val = (100 + (double) abs_val) / 100;
+
+    GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+        "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n",
+        GNUNET_i2s (&cur->peer), cur,
+        "GNUNET_ATS_QUALITY_NET_DELAY",
+        abs_val, rel_val);
     ph.env.sf.s_address_update_property (ph.solver, cur,
         GNUNET_ATS_QUALITY_NET_DELAY,
-        r_val, (double) (100 + r_val / 100));
+        abs_val, rel_val);
     break;
   case 1:
-    r_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10);
+    abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10);
+    rel_val = (100 + (double) abs_val) / 100;
 
-    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-        "Updating peer `%s' address %p type %s val %u\n",
-        GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DISTANCE", 
r_val);
+    GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+        "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n",
+        GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DISTANCE",
+        abs_val, rel_val);
     ph.env.sf.s_address_update_property (ph.solver, cur,
         GNUNET_ATS_QUALITY_NET_DISTANCE,
-        r_val, (double) (100 + r_val) / 100);
+        abs_val, rel_val);
     break;
   default:
     break;
@@ -446,15 +453,21 @@
     struct GNUNET_CONTAINER_MultiPeerMap * addresses,
     struct ATS_Address *address)
 {
+  double delay;
+  double distance;
+  uint32_t random = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
+  delay = (100 + (double) random) / 100;
   ph.env.sf.s_address_update_property (solver, address, 
GNUNET_ATS_QUALITY_NET_DELAY,
-      100,
-      (double) (100 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 
100))
-          / 100);
+      100,  delay);
 
+  random = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
+  distance = (100 + (double) random) / 100;
+
   ph.env.sf.s_address_update_property (solver, address,
-      GNUNET_ATS_QUALITY_NET_DISTANCE, 10,
-      (double) (100 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 
100))
-          / 100);
+      GNUNET_ATS_QUALITY_NET_DISTANCE, 10, distance);
+
+  GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+      "Initial update address %p : %.2f  %.2f\n", address, delay, distance);
 }
 
 /**
@@ -904,7 +917,7 @@
         cur_res->d_total.rel_value_us = 0;
       if (GNUNET_YES == cur->valid)
         cur_res->d_total.rel_value_us += cur->d_total.rel_value_us;
-      fprintf (stderr,
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
          "Total time to solve %s for %u peers %u addresses: %llu us\n",
          (GNUNET_YES == cur->update) ? "updated" : "full",
          cur->peers, cur->addresses,
@@ -920,7 +933,8 @@
         cur_res->d_setup.rel_value_us = 0;
       if (GNUNET_YES == cur->valid)
         cur_res->d_setup.rel_value_us += cur->d_setup.rel_value_us;
-      fprintf (stderr, "Total time to setup %s %u peers %u addresses: %llu 
us\n",
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+          "Total time to setup %s %u peers %u addresses: %llu us\n",
           (GNUNET_YES == cur->update) ? "updated" : "full",
           cur->peers, cur->addresses,
           (unsigned long long) cur->d_setup.rel_value_us);
@@ -936,7 +950,7 @@
         cur_res->d_lp.rel_value_us = 0;
       if (GNUNET_YES == cur->valid)
         cur_res->d_lp.rel_value_us += cur->d_lp.rel_value_us;
-      fprintf (stderr,
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
          "Total time to solve %s LP for %u peers %u addresses: %llu us\n",
          (GNUNET_YES == cur->update) ? "updated" : "full",
          cur->peers,
@@ -955,7 +969,8 @@
       if (GNUNET_YES == cur->valid)
         cur_res->d_mlp.rel_value_us += cur->d_mlp.rel_value_us;
 
-      fprintf (stderr, "Total time to solve %s MLP for %u peers %u addresses: 
%llu us\n",
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+          "Total time to solve %s MLP for %u peers %u addresses: %llu us\n",
           (GNUNET_YES == cur->update) ? "updated" : "full",
           cur->peers, cur->addresses,
           (unsigned long long )cur->d_mlp.rel_value_us);
@@ -1024,7 +1039,6 @@
 
   struct GNUNET_DISK_FileHandle *f_full;
   struct GNUNET_DISK_FileHandle *f_update;
-  struct Result *cur;
   char * data_fn_full;
   char * data_fn_update;
   char * data;
@@ -1058,7 +1072,7 @@
     if (NULL == f_full)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Cannot open gnuplot file `%s'\n",
+                  "Cannot open data file `%s'\n",
                   data_fn_full);
       GNUNET_free (data_fn_full);
       return;
@@ -1109,7 +1123,6 @@
                   data_fn_update);
   }
 
-  /* NEW log */
   for (c_peer = ph.N_peers_start; c_peer <= ph.N_peers_end; c_peer ++)
   {
     char * data_str;
@@ -1119,9 +1132,11 @@
     {
       struct Result *cur_res;
 
+      //fprintf (stderr, "P: %u I: %u  == %p \n", c_peer, c_iteration, 
cur_res);
       cur_res = ph.iterations_results[c_iteration].results_array[c_peer -1];
-      fprintf (stderr, "P: %u I: %u: P %i  A %i\n", c_peer, c_iteration, 
cur_res->peers, cur_res->addresses);
+      //fprintf (stderr, "P: %u I: %u: P %i  A %i\n", c_peer, c_iteration, 
cur_res->peers, cur_res->addresses);
       fprintf (stderr, "D total: %llu\n", (long long unsigned int) 
cur_res->d_total.rel_value_us);
+      fprintf (stderr, "D total: %llu\n", (long long unsigned int) 
cur_res->d_total.rel_value_us);
 
       data_tmp = GNUNET_strdup (data_str);
       GNUNET_free (data_str);
@@ -1137,7 +1152,6 @@
     GNUNET_DISK_file_write (f_full, data_str, strlen(data_str));
     GNUNET_free (data_str);
   }
-  /* NEW log */
 
   if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
@@ -1148,139 +1162,6 @@
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
         data_fn_update);
   GNUNET_free_non_null (data_fn_update);
-
-#if 0
-  for (c_o = 0; c_o < 2; c_o++)
-  {
-    if (0 == c_o)
-      fprintf (stderr,
-          "Duration for a full solution averaged over %i iterations\n",
-          ph.total_iterations);
-    if (1 == c_o)
-      fprintf (stderr,
-          "Duration for a full solution averaged over %i iterations\n",
-          ph.total_iterations);
-
-    for (c_i = 0; c_i <= ph.N_peers_end - ph.N_peers_start; c_i++)
-    {
-      if (0 == c_o)
-      {
-        cur = &ph.averaged_full_result[c_i];
-      }
-      else if ((GNUNET_YES == ph.measure_updates) && (1 == c_o))
-      {
-        cur = &ph.averaged_update_result[c_i];
-      }
-      else
-         break;
-
-      if (0 == cur->peers)
-        continue;
-
-      str_d_total = NULL;
-      str_d_setup = NULL;
-      str_d_lp = NULL;
-      str_d_mlp = NULL;
-
-      if (0 >= cur->valid)
-      {
-        fprintf (stderr,
-           "No valid results for %s for %u peers %u addresses!\n",
-           (GNUNET_YES == cur->update) ? "updated" : "full",
-               cur->peers, cur->addresses);
-        continue;
-      }
-
-      if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != 
cur->d_total.rel_value_us)
-      {
-        fprintf (stderr,
-           "Average total time from %u iterations to solve %s for %u peers %u 
addresses: %llu us\n",
-           cur->valid,
-           (GNUNET_YES == cur->update) ? "updated" : "full",
-               cur->peers, cur->addresses,
-           (unsigned long long) cur->d_total.rel_value_us / cur->valid);
-        GNUNET_asprintf(&str_d_total, "%llu",
-           (unsigned long long) cur->d_total.rel_value_us / cur->valid);
-      }
-      else
-        GNUNET_asprintf (&str_d_total, "-1");
-
-      if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != 
cur->d_setup.rel_value_us)
-      {
-        fprintf (stderr,
-           "Average total time from %u iterations to setup for %u peers %u 
addresses: %llu us\n",
-           cur->valid, cur->peers, cur->addresses,
-           (unsigned long long) cur->d_setup.rel_value_us / cur->valid);
-        GNUNET_asprintf(&str_d_setup, "%llu",
-           (unsigned long long) cur->d_setup.rel_value_us / cur->valid);
-
-      }
-      else
-        GNUNET_asprintf (&str_d_setup, "-1");
-
-      if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us)
-      {
-        fprintf (stderr,
-           "Average total time from %u iterations to solve lp %s for %u peers 
%u addresses: %llu us\n",
-           cur->valid,
-           (GNUNET_YES == cur->update) ? "updated" : "full",
-           cur->peers, cur->addresses,
-           (unsigned long long) cur->d_lp.rel_value_us / cur->valid);
-        GNUNET_asprintf(&str_d_lp, "%llu",
-           (unsigned long long) cur->d_lp.rel_value_us / ph.total_iterations);
-      }
-      else
-        GNUNET_asprintf (&str_d_lp, "-1");
-
-      if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us)
-      {
-        fprintf (stderr,
-           "Average total time from %u iterations to solve mlp %s for %u peers 
%u addresses: %llu us\n",
-           cur->valid,
-           (GNUNET_YES == cur->update) ? "updated" : "full",
-               cur->peers, cur->addresses,
-           (unsigned long long) cur->d_mlp.rel_value_us / cur->valid);
-        GNUNET_asprintf(&str_d_mlp, "%llu",
-           (unsigned long long) cur->d_mlp.rel_value_us / cur->valid);
-      }
-      else
-        GNUNET_asprintf (&str_d_mlp, "-1");
-
-      data = NULL;
-      if (GNUNET_YES == ph.create_datafile)
-      {
-        GNUNET_asprintf (&data,
-                         "%u;%u;%s;%s;%s;%s\n",
-                         cur->peers, cur->addresses,
-                         str_d_total,
-                         str_d_setup,
-                         str_d_lp,
-                         str_d_mlp);
-        if (cur->update == GNUNET_NO)
-        {
-          if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data, 
strlen(data)))
-            GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                        "Cannot write data to log file `%s'\n",
-                        data_fn_full);
-        }
-        if ((cur->update == GNUNET_YES) && (NULL != f_update))
-        {
-          if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, 
strlen(data)))
-            GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                        "Cannot write data to log file `%s'\n",
-                        data_fn_update);
-        }
-        GNUNET_free (data);
-      }
-
-      GNUNET_free_non_null (str_d_total);
-      GNUNET_free_non_null (str_d_setup);
-      GNUNET_free_non_null (str_d_lp);
-      GNUNET_free_non_null (str_d_mlp);
-    }
-  }
-#endif
-
 }
 
 /**
@@ -1297,8 +1178,8 @@
   int count_p = ph.N_peers_end;
   int count_a = ph.N_address;
   struct ATS_Address * cur_addr;
+  uint32_t net;
 
-
   ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc 
((count_p) * sizeof (struct Result *));
   ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer));
   for (cp = 0; cp < count_p; cp++)
@@ -1308,6 +1189,7 @@
 
   for (cp = 0; cp < count_p; cp++)
   {
+    fprintf (stderr,"%u..", cp);
     if (GNUNET_NO == ph.bulk_running)
     {
       ph.bulk_running = GNUNET_YES;
@@ -1318,7 +1200,14 @@
     {
       cur_addr = perf_create_address (cp, ca);
       /* Add address */
-      uint32_t net = 1 + GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
GNUNET_ATS_NetworkTypeCount - 1);
+
+      /* Random network selection */
+      //net = 1 + GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
GNUNET_ATS_NetworkTypeCount - 1);
+      /* Random equally distributed network selection */
+      net = 1 + (ca %  (GNUNET_ATS_NetworkTypeCount - 1));
+      /* fprintf (stderr, "Network: %u `%s'\n",
+       * mod_net , GNUNET_ATS_print_network_type(mod_net)); */
+
       cur_addr->atsi = GNUNET_new (struct GNUNET_ATS_Information);
       cur_addr->atsi_count = 1;
       cur_addr->atsi[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
@@ -1327,8 +1216,9 @@
 
       ph.current_a = ca + 1;
       perf_address_initial_update (ph.solver, ph.addresses, cur_addr);
-      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-          "Adding address for peer %u address %u\n", cp, ca);
+      GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+          "Adding address for peer %u address %u in network %s\n", cp, ca,
+          GNUNET_ATS_print_network_type(net));
     }
     /* Notify solver about request */
     ph.env.sf.s_get (ph.solver, &ph.peers[cp].id);
@@ -1372,7 +1262,7 @@
       GNUNET_assert (GNUNET_NO == ph.bulk_running);
     }
   }
-
+  fprintf (stderr,"\n");
   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
       "Done, cleaning up addresses\n");
   if (GNUNET_NO == ph.bulk_running)

Modified: gnunet/src/ats/perf_ats_solver.conf
===================================================================
--- gnunet/src/ats/perf_ats_solver.conf 2014-05-12 15:55:41 UTC (rev 33246)
+++ gnunet/src/ats/perf_ats_solver.conf 2014-05-12 16:47:50 UTC (rev 33247)
@@ -1,19 +1,50 @@
 [ats]
 # Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
+UNSPECIFIED_QUOTA_IN = 1000
+UNSPECIFIED_QUOTA_OUT = 1000
 # LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
+LOOPBACK_QUOTA_IN = 1000
+LOOPBACK_QUOTA_OUT = 1000
 # LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
+LAN_QUOTA_IN = 1000
+LAN_QUOTA_OUT = 1000
 # WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
+WAN_QUOTA_IN = 1000
+WAN_QUOTA_OUT = 1000
 # WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
+WLAN_QUOTA_IN = 1000
+WLAN_QUOTA_OUT = 1000
 # BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
+BLUETOOTH_QUOTA_IN = 1000
+BLUETOOTH_QUOTA_OUT = 1000
+
+# Proportional specific settings
+# How proportional to preferences is bandwidth distribution in a network
+# 1: Fair with respect to addresses without preferences
+# > 100: The bigger, the more respect is payed to preferences 
+PROP_PROPORTIONALITY_FACTOR = 200
+# Should we stick to existing connections are prefer to switch?
+# [100...200], lower value prefers to switch, bigger value is more tolerant
+PROP_STABILITY_FACTOR = 125
+
+# MLP specific settings
+# MLP defaults
+
+# Maximum duration for a solution process
+# MLP_MAX_DURATION = 3 s
+
+# Maximum number of iterations for a solution process
+# MLP_MAX_ITERATIONS = 1024
+# MLP_COEFFICIENT_D = 1.0
+# MLP_COEFFICIENT_U = 1.0
+# MLP_COEFFICIENT_R = 1.0
+MLP_MIN_BANDWIDTH = 1
+# MLP_MIN_CONNECTIONS = 4
+
+# MLP Log settings
+# Dump all problems to disk
+MLP_DUMP_PROBLEM_ALL = NO
+# Dump all solution to disk
+MLP_DUMP_SOLUTION_ALL = NO
+# Print GLPK output
+MLP_GLPK_VERBOSE = NO

Modified: gnunet/src/ats/plugin_ats_mlp.c
===================================================================
--- gnunet/src/ats/plugin_ats_mlp.c     2014-05-12 15:55:41 UTC (rev 33246)
+++ gnunet/src/ats/plugin_ats_mlp.c     2014-05-12 16:47:50 UTC (rev 33247)
@@ -736,12 +736,12 @@
   for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
   {
     addr_net = get_performance_info (address, GNUNET_ATS_NETWORK_TYPE);
+
     if (GNUNET_ATS_VALUE_UNDEFINED == addr_net)
     {
       GNUNET_break (0);
       addr_net = GNUNET_ATS_NET_UNSPECIFIED;
     }
-
     if (mlp->pv.quota_index[c] == addr_net)
     {
       mlp_create_problem_set_value (p, p->r_quota[c], mlpi->c_b, 1, __LINE__);
@@ -753,8 +753,16 @@
   /* For all quality metrics, set quality of this address */
   props = mlp->get_properties (mlp->get_properties_cls, address);
   for (c = 0; c < mlp->pv.m_q; c++)
+  {
+    if ((props[c] < 1.0) && (props[c] > 2.0))
+    {
+      fprintf (stderr, "PROP == %.3f \t ", props[c]);
+      GNUNET_break (0);
+    }
     mlp_create_problem_set_value (p, p->r_q[c], mlpi->c_b, props[c], __LINE__);
+  }
 
+  //fprintf (stderr, "\n");
   return GNUNET_OK;
 }
 
@@ -1173,7 +1181,7 @@
           return GNUNET_SYSERR;
         }
       notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, GAS_INFO_FULL);
-      mlp->control_param_lp.presolve = GLP_YES;
+      mlp->control_param_lp.presolve = GLP_YES; /* LP presolver, we need lp 
solution */
       mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP 
solution */
     }
   else
@@ -1192,7 +1200,8 @@
   start_cur_op = GNUNET_TIME_absolute_get();
 
   /* Solve LP */
-  mlp->control_param_lp.presolve = GLP_YES;
+  /* Only for debugging, always use LP presolver:
+   *  mlp->control_param_lp.presolve = GLP_YES; */
   res_lp = mlp_solve_lp_problem(mlp);
 
   dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op);
@@ -1200,6 +1209,7 @@
       (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
       (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : 
GAS_INFO_UPDATED);
 
+  res_lp = GNUNET_OK;
 
   /* Run MLP solver */
   if (GNUNET_OK == res_lp)
@@ -1210,7 +1220,8 @@
     start_cur_op = GNUNET_TIME_absolute_get();
 
     /* Solve MIP */
-    //mlp->control_param_mlp.presolve = GNUNET_YES;
+    /* Only for debugging, always use MLP presolver:
+     * mlp->control_param_mlp.presolve = GNUNET_YES; */
     res_mip = mlp_solve_mlp_problem(mlp);
 
     dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op);
@@ -1225,6 +1236,7 @@
     /* Do not execute mip solver since lp solution is invalid */
     dur_mlp = GNUNET_TIME_UNIT_ZERO;
     dur_total = GNUNET_TIME_absolute_get_duration (start_total);
+    //GNUNET_break(0);
     notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP, GAS_STAT_FAIL,
         (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : 
GAS_INFO_UPDATED);
     res_mip = GNUNET_SYSERR;
@@ -1254,7 +1266,7 @@
   mlp->ps.p_elements = mlp->p.num_elements;
 
   /* Propagate result*/
-  notify(mlp, GAS_OP_SOLVE_UPDATE_NOTIFICATION_START,
+  notify (mlp, GAS_OP_SOLVE_UPDATE_NOTIFICATION_START,
       (GNUNET_OK == res_lp) && (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : 
GAS_STAT_FAIL,
       GAS_INFO_NONE);
   if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip))
@@ -1262,7 +1274,7 @@
       GNUNET_CONTAINER_multipeermap_iterate(mlp->addresses,
           &mlp_propagate_results, mlp);
     }
-  notify(mlp, GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP,
+  notify (mlp, GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP,
       (GNUNET_OK == res_lp) && (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : 
GAS_STAT_FAIL,
       GAS_INFO_NONE);
 
@@ -1375,7 +1387,7 @@
 
   if (NULL == mlpi)
   {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
+      LOG (GNUNET_ERROR_TYPE_INFO,
           _("Updating address property `%s' for peer `%s' %p not added 
before\n"),
           GNUNET_ATS_print_property_type (type),
           GNUNET_i2s(&address->peer),
@@ -1390,9 +1402,11 @@
     /* Peer is not requested, so no need to update problem */
     return;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating property `%s' address for peer 
`%s'\n",
+  LOG (GNUNET_ERROR_TYPE_INFO, "Updating property `%s' address for peer `%s' 
to abs %llu rel %.3f\n",
       GNUNET_ATS_print_property_type (type),
-      GNUNET_i2s(&address->peer));
+      GNUNET_i2s(&address->peer),
+      abs_value,
+      rel_value);
 
   /* Find row index */
   type_index = -1;
@@ -1681,16 +1695,23 @@
   int c;
   preferences = mlp->get_preferences (mlp->get_preferences_cls, peer);
 
-  res = 1.0;
+  res = 0.0;
   for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
   {
     if (c != GNUNET_ATS_PREFERENCE_END)
     {
-      //fprintf (stderr, "VALUE[%u] %s %.3f \n", c, GNUNET_i2s 
(&cur->addr->peer), t[c]);
+      /* fprintf (stderr, "VALUE[%u] %s %.3f \n",
+       *        c, GNUNET_i2s (&cur->addr->peer), t[c]); */
       res += preferences[c];
     }
   }
+
   res /= (GNUNET_ATS_PreferenceCount -1);
+  res += 1.0;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer preference for peer  `%s' == %.2f\n",
+      GNUNET_i2s(peer), res);
+
   return res;
 }
 
@@ -1847,13 +1868,10 @@
   /* Update relativity constraint c9 */
   if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, 
peer)))
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR, "Updating preference for unknown peer 
`%s'\n", GNUNET_i2s(peer));
+    LOG (GNUNET_ERROR_TYPE_INFO, "Updating preference for unknown peer 
`%s'\n", GNUNET_i2s(peer));
     return;
   }
   p->f = get_peer_pref_value (mlp, peer);
-  /*
-  LOG (GNUNET_ERROR_TYPE_ERROR, "PEER PREF: %s %.2f\n",
-      GNUNET_i2s(peer), p->f);*/
   mlp_create_problem_update_value (&mlp->p, p->r_c9, mlp->p.c_r, -p->f, 
__LINE__);
 
   /* Problem size changed: new address for peer with pending request */




reply via email to

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