[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19174 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19174 - gnunet/src/ats |
Date: |
Mon, 16 Jan 2012 16:05:45 +0100 |
Author: wachs
Date: 2012-01-16 16:05:45 +0100 (Mon, 16 Jan 2012)
New Revision: 19174
Modified:
gnunet/src/ats/gnunet-service-ats_addresses.c
gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
gnunet/src/ats/gnunet-service-ats_addresses_mlp.h
Log:
- configuration for mlp coefficients
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2012-01-16 14:39:28 UTC
(rev 19173)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2012-01-16 15:05:45 UTC
(rev 19174)
@@ -536,6 +536,55 @@
GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_STATISTICS_Handle *stats)
{
+#if HAVE_LIBGLPK
+ double D;
+ double R;
+ double U;
+ long long unsigned int tmp;
+ unsigned int b_min;
+ unsigned int n_min;
+
+ /* Get diversity coefficient from configuration */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
+ "COEFFICIENT_D",
+ &tmp))
+ D = (double) tmp / 100;
+ else
+ D = 1.0;
+
+ /* Get proportionality coefficient from configuration */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
+ "COEFFICIENT_R",
+ &tmp))
+ R = (double) tmp / 100;
+ else
+ R = 1.0;
+
+ /* Get utilization coefficient from configuration */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
+ "COEFFICIENT_U",
+ &tmp))
+ U = (double) tmp / 100;
+ else
+ U = 1.0;
+
+ /* Get minimum bandwidth per used address from configuration */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
+ "MIN_BANDWIDTH",
+ &tmp))
+ b_min = tmp;
+ else
+ b_min = 64000;
+
+ /* Get minimum number of connections from configuration */
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
+ "MIN_CONNECTIONS",
+ &tmp))
+ n_min = tmp;
+ else
+ n_min = 4;
+#endif
+
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
"WAN_QUOTA_IN",
@@ -545,8 +594,6 @@
"WAN_QUOTA_OUT",
&wan_quota_out));
-
-
switch (GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP"))
{
/* MLP = YES */
@@ -554,9 +601,10 @@
#if HAVE_LIBGLPK
ats_mode = MLP;
/* Init the MLP solver with default values */
- mlp = GAS_mlp_init (stats, MLP_MAX_EXEC_DURATION,
MLP_MAX_ITERATIONS);
+ mlp = GAS_mlp_init (stats, MLP_MAX_EXEC_DURATION,
MLP_MAX_ITERATIONS, D, U, R, b_min, n_min);
break;
#else
+
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP mode was configured, but
libglpk is not installed, switching to simple mode");
ats_mode = SIMPLE;
break;
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-01-16 14:39:28 UTC
(rev 19173)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-01-16 15:05:45 UTC
(rev 19174)
@@ -285,12 +285,21 @@
* @param stats the GNUNET_STATISTICS handle
* @param max_duration maximum numbers of iterations for the LP/MLP Solver
* @param max_iterations maximum time limit for the LP/MLP Solver
+ * @param D Diversity coefficient
+ * @param U Utilization coefficient
+ * @param R Proportionality coefficient
+ * @param b_min minimum bandwidth assigned to an address
+ * @param n_min minimum number of addresses with bandwidth assigned
+ *
* @return struct GAS_MLP_Handle * on success, NULL on fail
*/
struct GAS_MLP_Handle *
GAS_mlp_init (const struct GNUNET_STATISTICS_Handle *stats,
struct GNUNET_TIME_Relative max_duration,
- unsigned int max_iterations)
+ unsigned int max_iterations,
+ double D, double U, double R,
+ unsigned int b_min,
+ unsigned int n_min)
{
struct GAS_MLP_Handle * mlp = GNUNET_malloc (sizeof (struct GAS_MLP_Handle));
@@ -326,6 +335,11 @@
mlp->last_execution = GNUNET_TIME_absolute_get_forever();
+ mlp->co_D = D;
+ mlp->co_R = R;
+ mlp->co_U = U;
+ mlp->b_min = b_min;
+ mlp->n_min = n_min;
mlp_create_problem (mlp);
return mlp;
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.h 2012-01-16 14:39:28 UTC
(rev 19173)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.h 2012-01-16 15:05:45 UTC
(rev 19174)
@@ -148,6 +148,11 @@
/* number of quality metrics */
int m;
+ /* minimum bandwidth assigned to an address */
+ unsigned int b_min;
+
+ /* minimum number of addresses with bandwidth assigned */
+ unsigned int n_min;
};
@@ -170,12 +175,21 @@
* @param stats the GNUNET_STATISTICS handle
* @param max_duration maximum numbers of iterations for the LP/MLP Solver
* @param max_iterations maximum time limit for the LP/MLP Solver
+ * @param D Diversity coefficient
+ * @param U Utilization coefficient
+ * @param R Proportionality coefficient
+ * @param b_min minimum bandwidth assigned to an address
+ * @param n_min minimum number of addresses with bandwidth assigned
+ *
* @return struct GAS_MLP_Handle * on success, NULL on fail
*/
struct GAS_MLP_Handle *
GAS_mlp_init (const struct GNUNET_STATISTICS_Handle *stats,
struct GNUNET_TIME_Relative max_duration,
- unsigned int max_iterations);
+ unsigned int max_iterations,
+ double D, double U, double R,
+ unsigned int b_min,
+ unsigned int n_min);
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19174 - gnunet/src/ats,
gnunet <=