* adapted using configuration settings and uses the following parameters:
* * MLP_MAX_DURATION:
* Maximum duration for a MLP solution procees (default: 3 sec.)
- * * MLP_MAX_DURATION:
+ * * MLP_MAX_ITERATIONS:
* Maximum number of iterations for a MLP solution process (default:
* 1024)
* * MLP_MIN_CONNECTIONS:
*/
#define DEBUG_MLP_PROBLEM_CREATION GNUNET_NO
-/**
- * Enable GLPK verbose output
- */
-#define VERBOSE_GLPK GNUNET_NO
/**
* Maximize bandwidth assigned
mlp_term_hook (void *info, const char *s)
{
/* Not needed atm struct MLP_information *mlp = info; */
- LOG (GNUNET_ERROR_TYPE_DEBUG, "%s", s);
+ LOG (GNUNET_ERROR_TYPE_ERROR, "%s", s);
return 1;
}
struct CountContext
{
- const struct GNUNET_CONTAINER_MultiPeerMap *peers;
+ const struct GNUNET_CONTAINER_MultiPeerMap *map;
int result;
};
struct CountContext *cctx = cls;
/* Check if we have to add this peer due to a pending request */
- if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (cctx->peers, key))
+ if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (cctx->map, key))
cctx->result++;
return GNUNET_OK;
}
static int
-mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *peers,
+mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *requested_peers,
const struct GNUNET_CONTAINER_MultiPeerMap *addresses)
{
struct CountContext cctx;
- cctx.peers = peers;
+ cctx.map = requested_peers;
cctx.result = 0;
GNUNET_CONTAINER_multipeermap_iterate (addresses,
- &mlp_create_problem_count_addresses_it, &cctx);
+ &mlp_create_problem_count_addresses_it, &cctx);
+ return cctx.result;
+}
+
+
+static int
+mlp_create_problem_count_peers_it (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
+{
+ struct CountContext *cctx = cls;
+
+ /* Check if we have to addresses for the requested peer */
+ if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (cctx->map, key))
+ cctx->result++;
+ return GNUNET_OK;
+}
+
+
+static int
+mlp_create_problem_count_peers (const struct GNUNET_CONTAINER_MultiPeerMap *requested_peers,
+ const struct GNUNET_CONTAINER_MultiPeerMap *addresses)
+{
+ struct CountContext cctx;
+
+ cctx.map = addresses;
+ cctx.result = 0;
+ GNUNET_CONTAINER_multipeermap_iterate (requested_peers,
+ &mlp_create_problem_count_peers_it, &cctx);
return cctx.result;
}
/* create the glpk problem */
p->prob = glp_create_prob ();
GNUNET_assert (NULL != p->prob);
- p->num_peers = GNUNET_CONTAINER_multipeermap_size (mlp->requested_peers);
+ p->num_peers = mlp_create_problem_count_peers (mlp->requested_peers, mlp->addresses);
p->num_addresses = mlp_create_problem_count_addresses (mlp->requested_peers, mlp->addresses);
/* Create problem matrix: 10 * #addresses + #q * #addresses + #q, + #peer + 2 + 1 */
int res_lp = 0;
int res_mip = 0;
- struct GNUNET_TIME_Absolute start;
+ struct GNUNET_TIME_Absolute start_total;
+ struct GNUNET_TIME_Absolute start_cur_op;
struct GNUNET_TIME_Relative dur_total;
struct GNUNET_TIME_Relative dur_setup;
struct GNUNET_TIME_Relative dur_lp;
GNUNET_assert(NULL != solver);
- if (GNUNET_YES == mlp->bulk_lock)
+ if (GNUNET_YES == mlp->stat_bulk_lock)
{
- mlp->bulk_request++;
+ mlp->stat_bulk_requests++;
return GNUNET_NO;
}
notify(mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS,
- (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
- start = GNUNET_TIME_absolute_get();
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
+ start_total = GNUNET_TIME_absolute_get();
if (0 == GNUNET_CONTAINER_multipeermap_size(mlp->requested_peers))
{
return GNUNET_OK; /* No addresses available */
}
- if ((GNUNET_NO == mlp->mlp_prob_changed)
- && (GNUNET_NO == mlp->mlp_prob_updated))
+ if ((GNUNET_NO == mlp->stat_mlp_prob_changed)
+ && (GNUNET_NO == mlp->stat_mlp_prob_updated))
{
LOG(GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n");
notify(mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE);
return GNUNET_OK;
}
- if (GNUNET_YES == mlp->mlp_prob_changed)
+ if (GNUNET_YES == mlp->stat_mlp_prob_changed)
{
LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n");
notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL);
LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n");
}
- dur_setup = GNUNET_TIME_absolute_get_duration (start);
- mlp->control_param_lp.presolve = GLP_YES;
- /* Run LP solver */
+ dur_setup = GNUNET_TIME_absolute_get_duration (start_total);
+ /* Run LP solver */
notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS,
- (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
LOG(GNUNET_ERROR_TYPE_DEBUG,
"Running LP solver %s\n",
(GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver");
+ start_cur_op = GNUNET_TIME_absolute_get();
+
+ /* Solve LP */
+ mlp->control_param_lp.presolve = GLP_YES;
res_lp = mlp_solve_lp_problem(mlp);
+
+ dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op);
notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP,
(GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
- (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
- dur_lp = GNUNET_TIME_absolute_get_duration (start);
- dur_lp = GNUNET_TIME_relative_subtract(dur_lp, dur_setup);
/* Run MLP solver */
- LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n");
- notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS,
- (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
- res_mip = mlp_solve_mlp_problem(mlp);
- notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP,
- (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
- (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
- notify(mlp, GAS_OP_SOLVE_STOP,
- (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
- (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
+ if (GNUNET_OK == res_lp)
+ {
+ LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n");
+ notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS,
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
+ start_cur_op = GNUNET_TIME_absolute_get();
- dur_mlp = GNUNET_TIME_absolute_get_duration (start);
- dur_mlp = GNUNET_TIME_relative_subtract(dur_mlp, dur_setup);
- dur_mlp = GNUNET_TIME_relative_subtract(dur_mlp, dur_lp);
- dur_total = GNUNET_TIME_absolute_get_duration (start);
+ /* Solve MIP */
+ //mlp->control_param_mlp.presolve = GNUNET_YES;
+ res_mip = mlp_solve_mlp_problem(mlp);
+
+ dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op);
+ dur_total = GNUNET_TIME_absolute_get_duration (start_total);
+
+ notify(mlp, GAS_OP_SOLVE_MLP_MLP_STOP,
+ (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
+ }
+ else
+ {
+ /* 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);
+ 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;
+ }
+
+
+ /* Notify about end */
+ notify(mlp, GAS_OP_SOLVE_STOP,
+ ((GNUNET_OK == res_mip) && (GNUNET_OK == res_mip)) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Execution time for %s solve: (total/setup/lp/mlp) : %llu %llu %llu %llu\n",
- (GNUNET_YES == mlp->mlp_prob_changed) ? "full" : "updated",
+ (GNUNET_YES == mlp->stat_mlp_prob_changed) ? "full" : "updated",
(unsigned long long) dur_total.rel_value_us,
(unsigned long long) dur_setup.rel_value_us,
(unsigned long long) dur_lp.rel_value_us,
GAS_INFO_NONE);
struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get();
- if (GNUNET_YES == mlp->write_mip_mps)
+ if ( (GNUNET_YES == mlp->opt_dump_solution_all) ||
+ (mlp->opt_dump_solution_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) )
{
/* Write problem to disk */
- GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers,
+ GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.lp", mlp->p.num_peers,
mlp->p.num_addresses, time.abs_value_us);
- LOG(GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename);
- glp_write_lp(mlp->p.prob, NULL, filename);
- GNUNET_free(filename);
- }
- if (GNUNET_YES == mlp->write_mip_sol)
- {
- /* Write solution to disk */
- GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers,
- mlp->p.num_addresses, time.abs_value_us);
- glp_print_mip(mlp->p.prob, filename);
- LOG(GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename);
+ LOG(GNUNET_ERROR_TYPE_ERROR, "Dumped problem to file: `%s' \n", filename);
+ glp_write_lp (mlp->p.prob, NULL, filename);
GNUNET_free(filename);
}
+ if ( (mlp->opt_dump_solution_all) ||
+ (mlp->opt_dump_solution_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) )
+ {
+ /* Write solution to disk */
+ GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers,
+ mlp->p.num_addresses, time.abs_value_us);
+ glp_print_mip(mlp->p.prob, filename);
+ LOG(GNUNET_ERROR_TYPE_ERROR, "Dumped solution to file: `%s' \n", filename);
+ GNUNET_free(filename);
+ }
/* Reset change and update marker */
mlp->control_param_lp.presolve = GLP_NO;
- mlp->mlp_prob_updated = GNUNET_NO;
- mlp->mlp_prob_changed = GNUNET_NO;
+ mlp->stat_mlp_prob_updated = GNUNET_NO;
+ mlp->stat_mlp_prob_changed = GNUNET_NO;
if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip))
return GNUNET_OK;
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;
- if (GNUNET_YES == mlp->mlp_auto_solve)
+ mlp->stat_mlp_prob_changed = GNUNET_YES;
+ if (GNUNET_YES == mlp->opt_mlp_auto_solve)
GAS_mlp_solve_problem (solver);
}
if (GNUNET_YES == mlp_create_problem_update_value (&mlp->p,
mlp->p.r_q[type_index], mlpi->c_b, rel_value, __LINE__))
{
- mlp->mlp_prob_updated = GNUNET_YES;
- if (GNUNET_YES == mlp->mlp_auto_solve)
+ mlp->stat_mlp_prob_updated = GNUNET_YES;
+ if (GNUNET_YES == mlp->opt_mlp_auto_solve)
GAS_mlp_solve_problem (solver);
}
}
}
}
- mlp->mlp_prob_changed = GNUNET_YES;
+ mlp->stat_mlp_prob_changed = GNUNET_YES;
}
if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
&address->peer)))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s for peer `%s' without address request \n",
+ LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' without address request \n",
(session_only == GNUNET_YES) ? "session" : "address",
GNUNET_i2s(&address->peer));
return;
GNUNET_i2s(&address->peer));
/* Problem size changed: new address for peer with pending request */
- mlp->mlp_prob_changed = GNUNET_YES;
- if (GNUNET_YES == mlp->mlp_auto_solve)
+ mlp->stat_mlp_prob_changed = GNUNET_YES;
+ if (GNUNET_YES == mlp->opt_mlp_auto_solve)
{
GAS_mlp_solve_problem (solver);
}
LOG (GNUNET_ERROR_TYPE_INFO, "Adding peer `%s' to list of requested_peers with requests\n",
GNUNET_i2s (peer));
- p = GNUNET_malloc (sizeof (struct ATS_Peer));
+ p = GNUNET_new (struct ATS_Peer);
p->id = (*peer);
p->f = get_peer_pref_value (mlp, peer);
GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
/* Added new peer, we have to rebuild problem before solving */
- mlp->mlp_prob_changed = GNUNET_YES;
+ mlp->stat_mlp_prob_changed = GNUNET_YES;
- if ((GNUNET_YES == mlp->mlp_auto_solve)&&
+ if ((GNUNET_YES == mlp->opt_mlp_auto_solve)&&
(GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains(mlp->addresses,
peer)))
{
GNUNET_assert (NULL != solver);
- s->bulk_lock ++;
+ s->stat_bulk_lock ++;
}
void
struct GAS_MLP_Handle *s = (struct GAS_MLP_Handle *) solver;
GNUNET_assert (NULL != solver);
- if (s->bulk_lock < 1)
+ if (s->stat_bulk_lock < 1)
{
GNUNET_break (0);
return;
}
- s->bulk_lock --;
+ s->stat_bulk_lock --;
- if (0 < s->bulk_request)
+ if (0 < s->stat_bulk_requests)
{
GAS_mlp_solve_problem (solver);
- s->bulk_request= 0;
+ s->stat_bulk_requests= 0;
}
}
GNUNET_CONTAINER_multipeermap_remove (mlp->requested_peers, peer, p);
GNUNET_free (p);
- mlp->mlp_prob_changed = GNUNET_YES;
- if (GNUNET_YES == mlp->mlp_auto_solve)
+ mlp->stat_mlp_prob_changed = GNUNET_YES;
+ if (GNUNET_YES == mlp->opt_mlp_auto_solve)
{
GAS_mlp_solve_problem (solver);
}
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 */
- mlp->mlp_prob_updated = GNUNET_YES;
- if (GNUNET_YES == mlp->mlp_auto_solve)
+ mlp->stat_mlp_prob_updated = GNUNET_YES;
+ if (GNUNET_YES == mlp->opt_mlp_auto_solve)
GAS_mlp_solve_problem (solver);
return;
}
libgnunet_plugin_ats_mlp_init (void *cls)
{
struct GNUNET_ATS_PluginEnvironment *env = cls;
- struct GAS_MLP_Handle * mlp = GNUNET_malloc (sizeof (struct GAS_MLP_Handle));
+ struct GAS_MLP_Handle * mlp = GNUNET_new (struct GAS_MLP_Handle);
double D;
double R;
long long unsigned int max_iterations;
GNUNET_assert (NULL != env->cfg);
- GNUNET_assert (NULL != env->stats);
GNUNET_assert (NULL != env->addresses);
GNUNET_assert (NULL != env->bandwidth_changed_cb);
GNUNET_assert (NULL != env->get_preferences);
break;
}
- mlp->write_mip_mps = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, "ats",
- "DUMP_MLP");
- if (GNUNET_SYSERR == mlp->write_mip_mps)
- mlp->write_mip_mps = GNUNET_NO;
- mlp->write_mip_sol = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, "ats",
- "DUMP_SOLUTION");
- if (GNUNET_SYSERR == mlp->write_mip_sol)
- mlp->write_mip_sol = GNUNET_NO;
+ mlp->opt_dump_problem_all = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+ "ats", "MLP_DUMP_PROBLEM_ALL");
+ if (GNUNET_SYSERR == mlp->opt_dump_problem_all)
+ mlp->opt_dump_problem_all = GNUNET_NO;
+
+ mlp->opt_dump_solution_all = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+ "ats", "MLP_DUMP_SOLUTION_ALL");
+ if (GNUNET_SYSERR == mlp->opt_dump_solution_all)
+ mlp->opt_dump_solution_all = GNUNET_NO;
+
+ mlp->opt_dump_problem_on_fail = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+ "ats", "MLP_DUMP_PROBLEM_ON_FAIL");
+ if (GNUNET_SYSERR == mlp->opt_dump_problem_on_fail)
+ mlp->opt_dump_problem_on_fail = GNUNET_NO;
+
+ mlp->opt_dump_solution_on_fail = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+ "ats", "MLP_DUMP_SOLUTION_ON_FAIL");
+ if (GNUNET_SYSERR == mlp->opt_dump_solution_on_fail)
+ mlp->opt_dump_solution_on_fail = GNUNET_NO;
+
+ mlp->opt_glpk_verbose = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+ "ats", "MLP_GLPK_VERBOSE");
+ if (GNUNET_SYSERR == mlp->opt_glpk_verbose)
+ mlp->opt_glpk_verbose = GNUNET_NO;
mlp->pv.BIG_M = (double) BIG_M_VALUE;
/* Get timeout for iterations */
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time(env->cfg, "ats", "MLP_MAX_DURATION", &max_duration))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time(env->cfg, "ats",
+ "MLP_MAX_DURATION", &max_duration))
{
max_duration = MLP_MAX_EXEC_DURATION;
}
/* Get maximum number of iterations */
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_size(env->cfg, "ats", "MLP_MAX_ITERATIONS", &max_iterations))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_size(env->cfg, "ats",
+ "MLP_MAX_ITERATIONS", &max_iterations))
{
max_iterations = MLP_MAX_ITERATIONS;
}
/* Get diversity coefficient from configuration */
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
- "MLP_COEFFICIENT_D",
- &tmp))
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg,
+ "ats", "MLP_COEFFICIENT_D", &tmp))
D = (double) tmp / 100;
else
D = DEFAULT_D;
/* Get proportionality coefficient from configuration */
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
- "MLP_COEFFICIENT_R",
- &tmp))
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg,
+ "ats", "MLP_COEFFICIENT_R", &tmp))
R = (double) tmp / 100;
else
R = DEFAULT_R;
/* Get utilization coefficient from configuration */
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
- "MLP_COEFFICIENT_U",
- &tmp))
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg,
+ "ats", "MLP_COEFFICIENT_U", &tmp))
U = (double) tmp / 100;
else
U = DEFAULT_U;
i_distance = c;
}
- if ((i_delay != MLP_NaN) && (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
- "MLP_COEFFICIENT_QUALITY_DELAY",
- &tmp)))
-
+ if ( (i_delay != MLP_NaN) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
+ "MLP_COEFFICIENT_QUALITY_DELAY", &tmp)) )
mlp->pv.co_Q[i_delay] = (double) tmp / 100;
else
mlp->pv.co_Q[i_delay] = DEFAULT_QUALITY;
- if ((i_distance != MLP_NaN) && (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
- "MLP_COEFFICIENT_QUALITY_DISTANCE",
- &tmp)))
+ if ( (i_distance != MLP_NaN) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_size (env->cfg, "ats",
+ "MLP_COEFFICIENT_QUALITY_DISTANCE", &tmp)) )
mlp->pv.co_Q[i_distance] = (double) tmp / 100;
else
mlp->pv.co_Q[i_distance] = DEFAULT_QUALITY;
mlp->pv.quota_out[c] = env->out_quota[c2];
mlp->pv.quota_in[c] = env->in_quota[c2];
found = GNUNET_YES;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Quota for network `%s' (in/out) %llu/%llu\n",
- GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]),
- mlp->pv.quota_out[c],
- mlp->pv.quota_in[c]);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Quota for network `%s' (in/out) %llu/%llu\n",
+ GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]),
+ mlp->pv.quota_out[c],
+ mlp->pv.quota_in[c]);
break;
}
}
/* Check if defined quota could make problem unsolvable */
if ((n_min * b_min) > mlp->pv.quota_out[c])
{
- LOG (GNUNET_ERROR_TYPE_INFO, _("Adjusting inconsistent outbound quota configuration for network `%s', is %llu must be at least %llu\n"),
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ _("Adjusting inconsistent outbound quota configuration for network `%s', is %llu must be at least %llu\n"),
GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]),
mlp->pv.quota_out[c],
(n_min * b_min));
}
if ((n_min * b_min) > mlp->pv.quota_in[c])
{
- LOG (GNUNET_ERROR_TYPE_INFO, _("Adjusting inconsistent inbound quota configuration for network `%s', is %llu must be at least %llu\n"),
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ _("Adjusting inconsistent inbound quota configuration for network `%s', is %llu must be at least %llu\n"),
GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]),
mlp->pv.quota_in[c],
(n_min * b_min));
/* Check if bandwidth is too big to make problem solvable */
if (mlp->pv.BIG_M < mlp->pv.quota_out[c])
{
- LOG (GNUNET_ERROR_TYPE_INFO, _("Adjusting outbound quota configuration for network `%s'from %llu to %.0f\n"),
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ _("Adjusting outbound quota configuration for network `%s'from %llu to %.0f\n"),
GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]),
mlp->pv.quota_out[c],
mlp->pv.BIG_M);
mlp->pv.b_min = b_min;
mlp->pv.n_min = n_min;
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->stat_mlp_prob_changed = GNUNET_NO;
+ mlp->stat_mlp_prob_updated = GNUNET_NO;
+ mlp->opt_mlp_auto_solve = GNUNET_YES;
mlp->requested_peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
- mlp->bulk_request = 0;
- mlp->bulk_lock = 0;
+ mlp->stat_bulk_requests = 0;
+ mlp->stat_bulk_lock = 0;
/* Setup GLPK */
/* Redirect GLPK output to GNUnet logging */
/* Init LP solving parameters */
glp_init_smcp(&mlp->control_param_lp);
mlp->control_param_lp.msg_lev = GLP_MSG_OFF;
-#if VERBOSE_GLPK
- mlp->control_param_lp.msg_lev = GLP_MSG_ALL;
-#endif
+ if (GNUNET_YES == mlp->opt_glpk_verbose)
+ mlp->control_param_lp.msg_lev = GLP_MSG_ALL;
+
mlp->control_param_lp.it_lim = max_iterations;
mlp->control_param_lp.tm_lim = max_duration.rel_value_us / 1000LL;
/* Init MLP solving parameters */
glp_init_iocp(&mlp->control_param_mlp);
mlp->control_param_mlp.msg_lev = GLP_MSG_OFF;
-#if VERBOSE_GLPK
- mlp->control_param_mlp.msg_lev = GLP_MSG_ALL;
-#endif
+ if (GNUNET_YES == mlp->opt_glpk_verbose)
+ mlp->control_param_mlp.msg_lev = GLP_MSG_ALL;
mlp->control_param_mlp.tm_lim = max_duration.rel_value_us / 1000LL;
LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n");