diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-13 12:47:54 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-13 12:47:54 +0000 |
commit | 9948a0b7e77fa3ae2d6ed28d7dc50236e869fc93 (patch) | |
tree | 53b1ab382b1c70cdab41de017bcc30a4380468a4 /src | |
parent | 093f0291be26fa3dfc6fc98a536028ef99517832 (diff) | |
download | gnunet-9948a0b7e77fa3ae2d6ed28d7dc50236e869fc93.tar.gz gnunet-9948a0b7e77fa3ae2d6ed28d7dc50236e869fc93.zip |
supporting additional log formats like MPS
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/perf_ats_solver.c | 4 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.conf | 38 | ||||
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 53 | ||||
-rw-r--r-- | src/ats/plugin_ats_mlp.h | 9 |
4 files changed, 83 insertions, 21 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 6504172d9..2017b794b 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -791,7 +791,11 @@ evaluate (int iteration) | |||
791 | if (0 == cp) | 791 | if (0 == cp) |
792 | continue; | 792 | continue; |
793 | if (NULL == cur) | 793 | if (NULL == cur) |
794 | { | ||
794 | GNUNET_break (0); | 795 | GNUNET_break (0); |
796 | fprintf (stderr, | ||
797 | "Missing result for %u peers\n", cp); | ||
798 | } | ||
795 | 799 | ||
796 | 800 | ||
797 | if (GNUNET_NO == cur->valid) | 801 | if (GNUNET_NO == cur->valid) |
diff --git a/src/ats/perf_ats_solver.conf b/src/ats/perf_ats_solver.conf index a48bae909..5bf7fc325 100644 --- a/src/ats/perf_ats_solver.conf +++ b/src/ats/perf_ats_solver.conf | |||
@@ -1,30 +1,30 @@ | |||
1 | [ats] | 1 | [ats] |
2 | # Network specific inbound/outbound quotas | 2 | # Network specific inbound/outbound quotas |
3 | UNSPECIFIED_QUOTA_IN = 10000 | 3 | UNSPECIFIED_QUOTA_IN = 1000 |
4 | UNSPECIFIED_QUOTA_OUT = 10000 | 4 | UNSPECIFIED_QUOTA_OUT = 1000 |
5 | # LOOPBACK | 5 | # LOOPBACK |
6 | LOOPBACK_QUOTA_IN = 10000 | 6 | LOOPBACK_QUOTA_IN = 100000 |
7 | LOOPBACK_QUOTA_OUT = 10000 | 7 | LOOPBACK_QUOTA_OUT = 100000 |
8 | # LAN | 8 | # LAN |
9 | LAN_QUOTA_IN = 10000 | 9 | LAN_QUOTA_IN = 100000 |
10 | LAN_QUOTA_OUT = 10000 | 10 | LAN_QUOTA_OUT = 100000 |
11 | # WAN | 11 | # WAN |
12 | WAN_QUOTA_IN = 10000 | 12 | WAN_QUOTA_IN = 100000 |
13 | WAN_QUOTA_OUT = 10000 | 13 | WAN_QUOTA_OUT = 100000 |
14 | # WLAN | 14 | # WLAN |
15 | WLAN_QUOTA_IN = 10000 | 15 | WLAN_QUOTA_IN = 1000 |
16 | WLAN_QUOTA_OUT = 10000 | 16 | WLAN_QUOTA_OUT = 1000 |
17 | # BLUETOOTH | 17 | # BLUETOOTH |
18 | BLUETOOTH_QUOTA_IN = 10000 | 18 | BLUETOOTH_QUOTA_IN = 1000 |
19 | BLUETOOTH_QUOTA_OUT = 10000 | 19 | BLUETOOTH_QUOTA_OUT = 1000 |
20 | 20 | ||
21 | # Proportional specific settings | 21 | # Proportional specific settings |
22 | # How proportional to preferences is bandwidth distribution in a network | 22 | # How proportional to preferences is bandwidth distribution in a network |
23 | # 1: Fair with respect to addresses without preferences | 23 | # 1: Fair with respect to addresses without preferences |
24 | # > 100: The bigger, the more respect is payed to preferences | 24 | # > 10: The bigger, the more respect is payed to preferences |
25 | PROP_PROPORTIONALITY_FACTOR = 200 | 25 | PROP_PROPORTIONALITY_FACTOR = 200 |
26 | # Should we stick to existing connections are prefer to switch? | 26 | # Should we stick to existing connections are prefer to switch? |
27 | # [100...200], lower value prefers to switch, bigger value is more tolerant | 27 | # [10...200], lower value prefers to switch, bigger value is more tolerant |
28 | PROP_STABILITY_FACTOR = 125 | 28 | PROP_STABILITY_FACTOR = 125 |
29 | 29 | ||
30 | # MLP specific settings | 30 | # MLP specific settings |
@@ -38,16 +38,18 @@ PROP_STABILITY_FACTOR = 125 | |||
38 | # MLP_COEFFICIENT_D = 1.0 | 38 | # MLP_COEFFICIENT_D = 1.0 |
39 | # MLP_COEFFICIENT_U = 1.0 | 39 | # MLP_COEFFICIENT_U = 1.0 |
40 | # MLP_COEFFICIENT_R = 1.0 | 40 | # MLP_COEFFICIENT_R = 1.0 |
41 | MLP_MIN_BANDWIDTH = 10 | 41 | MLP_MIN_BANDWIDTH = 1024 |
42 | # MLP_MIN_CONNECTIONS = 4 | 42 | # MLP_MIN_CONNECTIONS = 4 |
43 | MLP_DBG_FEASIBILITY_ONLY = NO | 43 | #MLP_DBG_FEASIBILITY_ONLY = YES |
44 | MLP_DBG_AUTOSCALE_PROBLEM = YES | 44 | MLP_DBG_AUTOSCALE_PROBLEM = YES |
45 | # MLP_DBG_INTOPT_PRESOLVE = YES | 45 | # MLP_DBG_INTOPT_PRESOLVE = YES |
46 | #MLP_DBG_GLPK_VERBOSE = YES | 46 | MLP_DBG_GLPK_VERBOSE = YES |
47 | |||
48 | MLP_LOG_FORMAT = MPS | ||
47 | 49 | ||
48 | # MLP Log settings | 50 | # MLP Log settings |
49 | # Dump all problems to disk | 51 | # Dump all problems to disk |
50 | MLP_DUMP_PROBLEM_ALL = NO | 52 | MLP_DUMP_PROBLEM_ALL = YES |
51 | # Dump all solution to disk | 53 | # Dump all solution to disk |
52 | MLP_DUMP_SOLUTION_ALL = NO | 54 | MLP_DUMP_SOLUTION_ALL = NO |
53 | # Print GLPK output | 55 | # Print GLPK output |
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index f168c08a3..4780daa8a 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -1331,10 +1331,28 @@ GAS_mlp_solve_problem (void *solver) | |||
1331 | (mlp->opt_dump_problem_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) ) | 1331 | (mlp->opt_dump_problem_on_fail && ((GNUNET_OK != res_lp) || (GNUNET_OK != res_mip))) ) |
1332 | { | 1332 | { |
1333 | /* Write problem to disk */ | 1333 | /* Write problem to disk */ |
1334 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.lp", mlp->p.num_peers, | 1334 | switch (mlp->opt_log_format) { |
1335 | mlp->p.num_addresses, time.abs_value_us); | 1335 | case MLP_CPLEX: |
1336 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.cplex", mlp->p.num_peers, | ||
1337 | mlp->p.num_addresses, time.abs_value_us); | ||
1338 | glp_write_lp (mlp->p.prob, NULL, filename); | ||
1339 | break; | ||
1340 | case MLP_GLPK: | ||
1341 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.glpk", mlp->p.num_peers, | ||
1342 | mlp->p.num_addresses, time.abs_value_us); | ||
1343 | glp_write_prob (mlp->p.prob, 0, filename); | ||
1344 | break; | ||
1345 | case MLP_MPS: | ||
1346 | GNUNET_asprintf(&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, | ||
1347 | mlp->p.num_addresses, time.abs_value_us); | ||
1348 | glp_write_mps (mlp->p.prob, GLP_MPS_FILE, NULL, filename); | ||
1349 | break; | ||
1350 | default: | ||
1351 | break; | ||
1352 | } | ||
1353 | |||
1354 | |||
1336 | LOG(GNUNET_ERROR_TYPE_ERROR, "Dumped problem to file: `%s' \n", filename); | 1355 | LOG(GNUNET_ERROR_TYPE_ERROR, "Dumped problem to file: `%s' \n", filename); |
1337 | glp_write_lp (mlp->p.prob, NULL, filename); | ||
1338 | GNUNET_free(filename); | 1356 | GNUNET_free(filename); |
1339 | } | 1357 | } |
1340 | if ( (mlp->opt_dump_solution_all) || | 1358 | if ( (mlp->opt_dump_solution_all) || |
@@ -2022,6 +2040,7 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2022 | int c; | 2040 | int c; |
2023 | int c2; | 2041 | int c2; |
2024 | int found; | 2042 | int found; |
2043 | char *outputformat; | ||
2025 | 2044 | ||
2026 | struct GNUNET_TIME_Relative max_duration; | 2045 | struct GNUNET_TIME_Relative max_duration; |
2027 | long long unsigned int max_iterations; | 2046 | long long unsigned int max_iterations; |
@@ -2111,6 +2130,34 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2111 | LOG (GNUNET_ERROR_TYPE_WARNING, | 2130 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2112 | "MLP solver is configured use the mlp presolver\n"); | 2131 | "MLP solver is configured use the mlp presolver\n"); |
2113 | 2132 | ||
2133 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (env->cfg, | ||
2134 | "ats", "MLP_LOG_FORMAT", &outputformat)) | ||
2135 | mlp->opt_log_format = MLP_CPLEX; | ||
2136 | else | ||
2137 | { | ||
2138 | GNUNET_STRINGS_utf8_toupper(outputformat, outputformat); | ||
2139 | if (0 == strcmp (outputformat, "MPS")) | ||
2140 | { | ||
2141 | mlp->opt_log_format = MLP_MPS; | ||
2142 | } | ||
2143 | else if (0 == strcmp (outputformat, "CPLEX")) | ||
2144 | { | ||
2145 | mlp->opt_log_format = MLP_CPLEX; | ||
2146 | } | ||
2147 | else if (0 == strcmp (outputformat, "GLPK")) | ||
2148 | { | ||
2149 | mlp->opt_log_format = MLP_GLPK; | ||
2150 | } | ||
2151 | else | ||
2152 | { | ||
2153 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
2154 | "Invalid log format `%s' in configuration, using CPLEX!\n", | ||
2155 | outputformat); | ||
2156 | mlp->opt_log_format = MLP_CPLEX; | ||
2157 | } | ||
2158 | GNUNET_free (outputformat); | ||
2159 | } | ||
2160 | |||
2114 | mlp->pv.BIG_M = (double) BIG_M_VALUE; | 2161 | mlp->pv.BIG_M = (double) BIG_M_VALUE; |
2115 | 2162 | ||
2116 | /* Get timeout for iterations */ | 2163 | /* Get timeout for iterations */ |
diff --git a/src/ats/plugin_ats_mlp.h b/src/ats/plugin_ats_mlp.h index 28a5d05c8..99895365a 100644 --- a/src/ats/plugin_ats_mlp.h +++ b/src/ats/plugin_ats_mlp.h | |||
@@ -56,6 +56,14 @@ | |||
56 | #define GLP_YES 1.0 | 56 | #define GLP_YES 1.0 |
57 | #define GLP_NO 0.0 | 57 | #define GLP_NO 0.0 |
58 | 58 | ||
59 | enum MLP_Output_Format | ||
60 | { | ||
61 | MLP_MPS, | ||
62 | MLP_CPLEX, | ||
63 | MLP_GLPK | ||
64 | }; | ||
65 | |||
66 | |||
59 | struct MLP_Solution | 67 | struct MLP_Solution |
60 | { | 68 | { |
61 | int lp_res; | 69 | int lp_res; |
@@ -356,6 +364,7 @@ struct GAS_MLP_Handle | |||
356 | */ | 364 | */ |
357 | int opt_dbg_glpk_verbose; | 365 | int opt_dbg_glpk_verbose; |
358 | 366 | ||
367 | enum MLP_Output_Format opt_log_format; | ||
359 | }; | 368 | }; |
360 | 369 | ||
361 | /** | 370 | /** |