diff options
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index 544b8d97f..8d2a872ab 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -148,7 +148,7 @@ struct MLP_Problem | |||
148 | /* Row indices quality metrics */ | 148 | /* Row indices quality metrics */ |
149 | int r_q[RQ_QUALITY_METRIC_COUNT]; | 149 | int r_q[RQ_QUALITY_METRIC_COUNT]; |
150 | /* Row indices ATS network quotas */ | 150 | /* Row indices ATS network quotas */ |
151 | int r_quota[GNUNET_ATS_NetworkTypeCount]; | 151 | int r_quota[GNUNET_NT_COUNT]; |
152 | 152 | ||
153 | /* Column index Diversity (D) column */ | 153 | /* Column index Diversity (D) column */ |
154 | int c_d; | 154 | int c_d; |
@@ -211,12 +211,12 @@ struct MLP_Variables | |||
211 | 211 | ||
212 | /* Quotas */ | 212 | /* Quotas */ |
213 | /* Array mapping array index to ATS network */ | 213 | /* Array mapping array index to ATS network */ |
214 | int quota_index[GNUNET_ATS_NetworkTypeCount]; | 214 | int quota_index[GNUNET_NT_COUNT]; |
215 | /* Outbound quotas */ | 215 | /* Outbound quotas */ |
216 | unsigned long long quota_out[GNUNET_ATS_NetworkTypeCount]; | 216 | unsigned long long quota_out[GNUNET_NT_COUNT]; |
217 | /* Inbound quotas */ | 217 | /* Inbound quotas */ |
218 | 218 | ||
219 | unsigned long long quota_in[GNUNET_ATS_NetworkTypeCount]; | 219 | unsigned long long quota_in[GNUNET_NT_COUNT]; |
220 | 220 | ||
221 | /* ATS ressource costs | 221 | /* ATS ressource costs |
222 | * array with GNUNET_ATS_QualityPropertiesCount elements | 222 | * array with GNUNET_ATS_QualityPropertiesCount elements |
@@ -601,7 +601,7 @@ mlp_delete_problem (struct GAS_MLP_Handle *mlp) | |||
601 | mlp->p.r_c9 = MLP_UNDEFINED; | 601 | mlp->p.r_c9 = MLP_UNDEFINED; |
602 | for (c = 0; c < RQ_QUALITY_METRIC_COUNT ; c ++) | 602 | for (c = 0; c < RQ_QUALITY_METRIC_COUNT ; c ++) |
603 | mlp->p.r_q[c] = MLP_UNDEFINED; | 603 | mlp->p.r_q[c] = MLP_UNDEFINED; |
604 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c ++) | 604 | for (c = 0; c < GNUNET_NT_COUNT; c ++) |
605 | mlp->p.r_quota[c] = MLP_UNDEFINED; | 605 | mlp->p.r_quota[c] = MLP_UNDEFINED; |
606 | mlp->p.ci = MLP_UNDEFINED; | 606 | mlp->p.ci = MLP_UNDEFINED; |
607 | 607 | ||
@@ -969,20 +969,20 @@ mlp_create_problem_add_address_information (void *cls, | |||
969 | } | 969 | } |
970 | 970 | ||
971 | addr_net = address->properties.scope; | 971 | addr_net = address->properties.scope; |
972 | for (addr_net_index = 0; addr_net_index < GNUNET_ATS_NetworkTypeCount; addr_net_index++) | 972 | for (addr_net_index = 0; addr_net_index < GNUNET_NT_COUNT; addr_net_index++) |
973 | { | 973 | { |
974 | if (mlp->pv.quota_index[addr_net_index] == addr_net) | 974 | if (mlp->pv.quota_index[addr_net_index] == addr_net) |
975 | break; | 975 | break; |
976 | } | 976 | } |
977 | 977 | ||
978 | if (addr_net_index >= GNUNET_ATS_NetworkTypeCount) | 978 | if (addr_net_index >= GNUNET_NT_COUNT) |
979 | { | 979 | { |
980 | GNUNET_break (0); | 980 | GNUNET_break (0); |
981 | return GNUNET_OK; | 981 | return GNUNET_OK; |
982 | } | 982 | } |
983 | 983 | ||
984 | max_quota = 0; | 984 | max_quota = 0; |
985 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 985 | for (c = 0; c < GNUNET_NT_COUNT; c++) |
986 | { | 986 | { |
987 | if (mlp->pv.quota_out[c] > max_quota) | 987 | if (mlp->pv.quota_out[c] > max_quota) |
988 | max_quota = mlp->pv.quota_out[c]; | 988 | max_quota = mlp->pv.quota_out[c]; |
@@ -1131,11 +1131,11 @@ mlp_create_problem_add_invariant_rows (struct GAS_MLP_Handle *mlp, struct MLP_Pr | |||
1131 | p->r_c4 = mlp_create_problem_create_constraint (p, "c4", GLP_LO, (mlp->pv.n_min > p->num_peers) ? p->num_peers : mlp->pv.n_min, 0.0); | 1131 | p->r_c4 = mlp_create_problem_create_constraint (p, "c4", GLP_LO, (mlp->pv.n_min > p->num_peers) ? p->num_peers : mlp->pv.n_min, 0.0); |
1132 | 1132 | ||
1133 | /* Rows for c 10) Enforce network quotas */ | 1133 | /* Rows for c 10) Enforce network quotas */ |
1134 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 1134 | for (c = 0; c < GNUNET_NT_COUNT; c++) |
1135 | { | 1135 | { |
1136 | char * text; | 1136 | char * text; |
1137 | GNUNET_asprintf(&text, "c10_quota_ats_%s", | 1137 | GNUNET_asprintf(&text, "c10_quota_ats_%s", |
1138 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c])); | 1138 | GNUNET_NT_to_string(mlp->pv.quota_index[c])); |
1139 | p->r_quota[c] = mlp_create_problem_create_constraint (p, text, GLP_DB, 0.0, mlp->pv.quota_out[c]); | 1139 | p->r_quota[c] = mlp_create_problem_create_constraint (p, text, GLP_DB, 0.0, mlp->pv.quota_out[c]); |
1140 | GNUNET_free (text); | 1140 | GNUNET_free (text); |
1141 | } | 1141 | } |
@@ -1853,7 +1853,7 @@ GAS_mlp_address_add (void *solver, | |||
1853 | { | 1853 | { |
1854 | struct GAS_MLP_Handle *mlp = solver; | 1854 | struct GAS_MLP_Handle *mlp = solver; |
1855 | 1855 | ||
1856 | if (GNUNET_ATS_NetworkTypeCount <= network) | 1856 | if (GNUNET_NT_COUNT <= network) |
1857 | { | 1857 | { |
1858 | GNUNET_break (0); | 1858 | GNUNET_break (0); |
1859 | return; | 1859 | return; |
@@ -2651,7 +2651,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2651 | n_min = MLP_DEFAULT_MIN_CONNECTIONS; | 2651 | n_min = MLP_DEFAULT_MIN_CONNECTIONS; |
2652 | 2652 | ||
2653 | /* Init network quotas */ | 2653 | /* Init network quotas */ |
2654 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 2654 | for (c = 0; c < GNUNET_NT_COUNT; c++) |
2655 | { | 2655 | { |
2656 | mlp->pv.quota_index[c] = c; | 2656 | mlp->pv.quota_index[c] = c; |
2657 | mlp->pv.quota_out[c] = env->out_quota[c]; | 2657 | mlp->pv.quota_out[c] = env->out_quota[c]; |
@@ -2659,7 +2659,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2659 | 2659 | ||
2660 | LOG (GNUNET_ERROR_TYPE_INFO, | 2660 | LOG (GNUNET_ERROR_TYPE_INFO, |
2661 | "Quota for network `%s' (in/out) %llu/%llu\n", | 2661 | "Quota for network `%s' (in/out) %llu/%llu\n", |
2662 | GNUNET_ATS_print_network_type (c), | 2662 | GNUNET_NT_to_string (c), |
2663 | mlp->pv.quota_out[c], | 2663 | mlp->pv.quota_out[c], |
2664 | mlp->pv.quota_in[c]); | 2664 | mlp->pv.quota_in[c]); |
2665 | /* Check if defined quota could make problem unsolvable */ | 2665 | /* Check if defined quota could make problem unsolvable */ |
@@ -2667,7 +2667,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2667 | { | 2667 | { |
2668 | LOG (GNUNET_ERROR_TYPE_INFO, | 2668 | LOG (GNUNET_ERROR_TYPE_INFO, |
2669 | _("Adjusting inconsistent outbound quota configuration for network `%s', is %llu must be at least %llu\n"), | 2669 | _("Adjusting inconsistent outbound quota configuration for network `%s', is %llu must be at least %llu\n"), |
2670 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2670 | GNUNET_NT_to_string(mlp->pv.quota_index[c]), |
2671 | mlp->pv.quota_out[c], | 2671 | mlp->pv.quota_out[c], |
2672 | (n_min * b_min)); | 2672 | (n_min * b_min)); |
2673 | mlp->pv.quota_out[c] = (n_min * b_min); | 2673 | mlp->pv.quota_out[c] = (n_min * b_min); |
@@ -2676,7 +2676,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2676 | { | 2676 | { |
2677 | LOG (GNUNET_ERROR_TYPE_INFO, | 2677 | LOG (GNUNET_ERROR_TYPE_INFO, |
2678 | _("Adjusting inconsistent inbound quota configuration for network `%s', is %llu must be at least %llu\n"), | 2678 | _("Adjusting inconsistent inbound quota configuration for network `%s', is %llu must be at least %llu\n"), |
2679 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2679 | GNUNET_NT_to_string(mlp->pv.quota_index[c]), |
2680 | mlp->pv.quota_in[c], | 2680 | mlp->pv.quota_in[c], |
2681 | (n_min * b_min)); | 2681 | (n_min * b_min)); |
2682 | mlp->pv.quota_in[c] = (n_min * b_min); | 2682 | mlp->pv.quota_in[c] = (n_min * b_min); |
@@ -2686,7 +2686,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2686 | { | 2686 | { |
2687 | LOG (GNUNET_ERROR_TYPE_INFO, | 2687 | LOG (GNUNET_ERROR_TYPE_INFO, |
2688 | _("Adjusting outbound quota configuration for network `%s'from %llu to %.0f\n"), | 2688 | _("Adjusting outbound quota configuration for network `%s'from %llu to %.0f\n"), |
2689 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2689 | GNUNET_NT_to_string(mlp->pv.quota_index[c]), |
2690 | mlp->pv.quota_out[c], | 2690 | mlp->pv.quota_out[c], |
2691 | mlp->pv.BIG_M); | 2691 | mlp->pv.BIG_M); |
2692 | mlp->pv.quota_out[c] = mlp->pv.BIG_M ; | 2692 | mlp->pv.quota_out[c] = mlp->pv.BIG_M ; |
@@ -2695,7 +2695,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2695 | { | 2695 | { |
2696 | LOG (GNUNET_ERROR_TYPE_INFO, | 2696 | LOG (GNUNET_ERROR_TYPE_INFO, |
2697 | _("Adjusting inbound quota configuration for network `%s' from %llu to %.0f\n"), | 2697 | _("Adjusting inbound quota configuration for network `%s' from %llu to %.0f\n"), |
2698 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2698 | GNUNET_NT_to_string(mlp->pv.quota_index[c]), |
2699 | mlp->pv.quota_in[c], | 2699 | mlp->pv.quota_in[c], |
2700 | mlp->pv.BIG_M); | 2700 | mlp->pv.BIG_M); |
2701 | mlp->pv.quota_in[c] = mlp->pv.BIG_M ; | 2701 | mlp->pv.quota_in[c] = mlp->pv.BIG_M ; |