aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-13 12:47:54 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-13 12:47:54 +0000
commit9948a0b7e77fa3ae2d6ed28d7dc50236e869fc93 (patch)
tree53b1ab382b1c70cdab41de017bcc30a4380468a4 /src
parent093f0291be26fa3dfc6fc98a536028ef99517832 (diff)
downloadgnunet-9948a0b7e77fa3ae2d6ed28d7dc50236e869fc93.tar.gz
gnunet-9948a0b7e77fa3ae2d6ed28d7dc50236e869fc93.zip
supporting additional log formats like MPS
Diffstat (limited to 'src')
-rw-r--r--src/ats/perf_ats_solver.c4
-rw-r--r--src/ats/perf_ats_solver.conf38
-rw-r--r--src/ats/plugin_ats_mlp.c53
-rw-r--r--src/ats/plugin_ats_mlp.h9
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
3UNSPECIFIED_QUOTA_IN = 10000 3UNSPECIFIED_QUOTA_IN = 1000
4UNSPECIFIED_QUOTA_OUT = 10000 4UNSPECIFIED_QUOTA_OUT = 1000
5# LOOPBACK 5# LOOPBACK
6LOOPBACK_QUOTA_IN = 10000 6LOOPBACK_QUOTA_IN = 100000
7LOOPBACK_QUOTA_OUT = 10000 7LOOPBACK_QUOTA_OUT = 100000
8# LAN 8# LAN
9LAN_QUOTA_IN = 10000 9LAN_QUOTA_IN = 100000
10LAN_QUOTA_OUT = 10000 10LAN_QUOTA_OUT = 100000
11# WAN 11# WAN
12WAN_QUOTA_IN = 10000 12WAN_QUOTA_IN = 100000
13WAN_QUOTA_OUT = 10000 13WAN_QUOTA_OUT = 100000
14# WLAN 14# WLAN
15WLAN_QUOTA_IN = 10000 15WLAN_QUOTA_IN = 1000
16WLAN_QUOTA_OUT = 10000 16WLAN_QUOTA_OUT = 1000
17# BLUETOOTH 17# BLUETOOTH
18BLUETOOTH_QUOTA_IN = 10000 18BLUETOOTH_QUOTA_IN = 1000
19BLUETOOTH_QUOTA_OUT = 10000 19BLUETOOTH_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
25PROP_PROPORTIONALITY_FACTOR = 200 25PROP_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
28PROP_STABILITY_FACTOR = 125 28PROP_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
41MLP_MIN_BANDWIDTH = 10 41MLP_MIN_BANDWIDTH = 1024
42# MLP_MIN_CONNECTIONS = 4 42# MLP_MIN_CONNECTIONS = 4
43MLP_DBG_FEASIBILITY_ONLY = NO 43#MLP_DBG_FEASIBILITY_ONLY = YES
44MLP_DBG_AUTOSCALE_PROBLEM = YES 44MLP_DBG_AUTOSCALE_PROBLEM = YES
45# MLP_DBG_INTOPT_PRESOLVE = YES 45# MLP_DBG_INTOPT_PRESOLVE = YES
46#MLP_DBG_GLPK_VERBOSE = YES 46MLP_DBG_GLPK_VERBOSE = YES
47
48MLP_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
50MLP_DUMP_PROBLEM_ALL = NO 52MLP_DUMP_PROBLEM_ALL = YES
51# Dump all solution to disk 53# Dump all solution to disk
52MLP_DUMP_SOLUTION_ALL = NO 54MLP_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
59enum MLP_Output_Format
60{
61 MLP_MPS,
62 MLP_CPLEX,
63 MLP_GLPK
64};
65
66
59struct MLP_Solution 67struct 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/**