aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-16 07:40:49 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-16 07:40:49 +0000
commit4932af68493bdb0f8ea88703c838a9c3d653d467 (patch)
tree4aa1b44815e3f3794a060d9806fd5e18564aaa88 /src/ats
parente4ac5a9cdcfa8694c09805989a92b735e447016e (diff)
downloadgnunet-4932af68493bdb0f8ea88703c838a9c3d653d467.tar.gz
gnunet-4932af68493bdb0f8ea88703c838a9c3d653d467.zip
fixing division by zero in normalization
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/gnunet-service-ats_normalization.c5
-rw-r--r--src/ats/perf_ats_solver.c4
-rw-r--r--src/ats/perf_ats_solver.conf35
3 files changed, 29 insertions, 15 deletions
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index d26055ea9..0423db673 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -733,7 +733,10 @@ normalize_address (void *cls, const struct GNUNET_PeerIdentity *h, void *k)
733 avg_value = address->atsin[p->prop_type].avg; 733 avg_value = address->atsin[p->prop_type].avg;
734 delta = p->max - p->min; 734 delta = p->max - p->min;
735 /* max - 2 * min + avg_value / max - min */ 735 /* max - 2 * min + avg_value / max - min */
736 address->atsin[p->prop_type].norm = (delta + (avg_value - p->min)) / (delta); 736 if (0 != delta)
737 address->atsin[p->prop_type].norm = (delta + (avg_value - p->min)) / (delta);
738 else
739 address->atsin[p->prop_type].norm = DEFAULT_REL_QUALITY;
737 740
738 if (backup == address->atsin[p->prop_type].norm) 741 if (backup == address->atsin[p->prop_type].norm)
739 return GNUNET_OK; 742 return GNUNET_OK;
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c
index 95adea4b3..a5307028d 100644
--- a/src/ats/perf_ats_solver.c
+++ b/src/ats/perf_ats_solver.c
@@ -970,7 +970,7 @@ write_all_iterations (void)
970 } 970 }
971 else 971 else
972 { 972 {
973 GNUNET_asprintf (&data_str, "%s;", data_tmp); 973 GNUNET_asprintf (&data_upd_str, "%s;", data_upd_tmp);
974 } 974 }
975 GNUNET_free (data_upd_tmp); 975 GNUNET_free (data_upd_tmp);
976 976
@@ -1010,7 +1010,7 @@ write_all_iterations (void)
1010 GNUNET_asprintf (&data_upd_str, "%s\n", data_upd_tmp); 1010 GNUNET_asprintf (&data_upd_str, "%s\n", data_upd_tmp);
1011 GNUNET_free (data_upd_tmp); 1011 GNUNET_free (data_upd_tmp);
1012 1012
1013 fprintf (stderr, "Result updated solution: %s\n", data_upd_str); 1013 fprintf (stderr, "Result updated solution: `%s'\n", data_upd_str);
1014 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data_upd_str, strlen(data_upd_str))) 1014 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data_upd_str, strlen(data_upd_str)))
1015 GNUNET_break (0); 1015 GNUNET_break (0);
1016 GNUNET_free (data_upd_str); 1016 GNUNET_free (data_upd_str);
diff --git a/src/ats/perf_ats_solver.conf b/src/ats/perf_ats_solver.conf
index c8e13206c..c68075bf6 100644
--- a/src/ats/perf_ats_solver.conf
+++ b/src/ats/perf_ats_solver.conf
@@ -3,20 +3,20 @@
3UNSPECIFIED_QUOTA_IN = 1000000 3UNSPECIFIED_QUOTA_IN = 1000000
4UNSPECIFIED_QUOTA_OUT = 1000000 4UNSPECIFIED_QUOTA_OUT = 1000000
5# LOOPBACK 5# LOOPBACK
6LOOPBACK_QUOTA_IN = 1000000 6LOOPBACK_QUOTA_IN = 10000000
7LOOPBACK_QUOTA_OUT = 1000000 7LOOPBACK_QUOTA_OUT = 10000000
8# LAN 8# LAN
9LAN_QUOTA_IN = 1000000 9LAN_QUOTA_IN = 10000000
10LAN_QUOTA_OUT = 1000000 10LAN_QUOTA_OUT = 10000000
11# WAN 11# WAN
12WAN_QUOTA_IN = 1000000 12WAN_QUOTA_IN = 10000000
13WAN_QUOTA_OUT = 1000000 13WAN_QUOTA_OUT = 10000000
14# WLAN 14# WLAN
15WLAN_QUOTA_IN = 1000000 15WLAN_QUOTA_IN = 10000000
16WLAN_QUOTA_OUT = 1000000 16WLAN_QUOTA_OUT = 10000000
17# BLUETOOTH 17# BLUETOOTH
18BLUETOOTH_QUOTA_IN = 1000000 18BLUETOOTH_QUOTA_IN = 10000000
19BLUETOOTH_QUOTA_OUT = 1000000 19BLUETOOTH_QUOTA_OUT = 10000000
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
@@ -31,7 +31,7 @@ PROP_STABILITY_FACTOR = 1.25
31# MLP defaults 31# MLP defaults
32 32
33# Maximum duration for a solution process 33# Maximum duration for a solution process
34# MLP_MAX_DURATION = 3 s 34# MLP_MAX_DURATION = 30 s
35 35
36# Maximum number of iterations for a solution process 36# Maximum number of iterations for a solution process
37# MLP_MAX_ITERATIONS = 1024 37# MLP_MAX_ITERATIONS = 1024
@@ -49,7 +49,7 @@ MLP_MIN_BANDWIDTH = 10
49MLP_DBG_AUTOSCALE_PROBLEM = YES 49MLP_DBG_AUTOSCALE_PROBLEM = YES
50# MLP_DBG_INTOPT_PRESOLVE = YES 50# MLP_DBG_INTOPT_PRESOLVE = YES
51# Print GLPK output 51# Print GLPK output
52#MLP_DBG_GLPK_VERBOSE = YES 52MLP_DBG_GLPK_VERBOSE = YES
53 53
54#MLP_DBG_OPTIMIZE_UTILITY = NO 54#MLP_DBG_OPTIMIZE_UTILITY = NO
55#MLP_DBG_OPTIMIZE_QUALITY = NO 55#MLP_DBG_OPTIMIZE_QUALITY = NO
@@ -64,3 +64,14 @@ MLP_LOG_FORMAT = CPLEX
64# Dump all solution to disk 64# Dump all solution to disk
65# MLP_DUMP_SOLUTION_ALL = YES 65# MLP_DUMP_SOLUTION_ALL = YES
66 66
67# RIL specifc settings
68RIL_STEP_TIME_MIN = 1 ms
69RIL_STEP_TIME_MAX = 10 ms
70
71RIL_ALGORITHM = Q
72RIL_DISCOUNT_BETA = 0.7
73RIL_GRADIENT_STEP_SIZE = 0.3
74RIL_TRACE_DECAY = 0.2
75RIL_EXPLORE_RATIO = 0.1
76RIL_GLOBAL_REWARD_SHARE = 1
77