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",
"WAN_QUOTA_OUT",
&wan_quota_out));
-
-
switch (GNUNET_CONFIGURATION_get_value_yesno (cfg, "ats", "MLP"))
{
/* MLP = YES */
#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;
* @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));
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;
/* 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;
};
* @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);
/**