commit 795c59b073582562bfcbc587b440cd9161366901
Author: Karsten Loesing <karsten.loesing(a)gmx.net>
Date: Wed Aug 22 13:34:12 2012 +0200
Update to new #6498 requirements.
- Remove /24 requirement for almost fast exits.
- Remove code for comparing different advertised bandwidhts.
---
task-6498/plot.R | 32 ++++++--------------------------
task-6498/src/Main.java | 37 ++++++++++++++++---------------------
2 files changed, 22 insertions(+), 47 deletions(-)
diff --git a/task-6498/plot.R b/task-6498/plot.R
index 9f7763d..cebe490 100644
--- a/task-6498/plot.R
+++ b/task-6498/plot.R
@@ -7,12 +7,12 @@ DETAIL <- "day"
require(ggplot2)
require(reshape)
require(RColorBrewer)
-data <- read.csv("results.csv", stringsAsFactors = FALSE)
+data <- read.csv("task-6498-results.csv", stringsAsFactors = FALSE)
data <- data[data$valid_after >= paste(CUTOFF, "00:00:00"), ]
r <- data
r <- r[r$min_rate == 11875 & r$ports == "80-443-554-1755" &
- r$min_advbw == 5000, ]
+ r$min_advbw == 5000 & r$same_network == TRUE, ]
r <- aggregate(list(relays = r$relays, P_exit = 100 * r$exit_prob),
by = list(date = as.Date(cut.Date(as.Date(r$valid_after), DETAIL))),
FUN = median)
@@ -31,33 +31,13 @@ opts(title = paste("Fast relays (95+ Mbit/s configured bandwidth rate,\n",
"at most 2 relays per /24 network)\n", sep = ""))
ggsave("fast-exits.png", width = 8, height = 6, dpi = 100)
-s <- data
-s <- s[s$min_rate == 11875 & s$ports == "80-443-554-1755", ]
-s <- aggregate(list(relays = s$relays, P_exit = 100 * s$exit_prob),
- by = list(date = as.Date(cut.Date(as.Date(s$valid_after), DETAIL)),
- min_advbw = s$min_advbw), FUN = median)
-s <- melt(s, id.vars = c("date", "min_advbw"))
-s <- data.frame(s, type = ifelse(s$variable == "P_exit",
- "Total exit probability (in %)", "Number of relays"))
-ggplot(s, aes(x = date, y = value, colour = as.factor(min_advbw))) +
-geom_line() +
-facet_grid(type ~ ., scales = "free_y") +
-scale_x_date(name = "") +
-scale_y_continuous(name = "") +
-scale_colour_manual(name = "Advertised bandwidth (in KB/s)",
- values = brewer.pal(6, "Purples")[2:6]) +
-opts(title = paste("Relays meeting the fast-exit requirements\nwith",
- "varying minimum advertised bandwidth capacities"),
- legend.position = "top")
-ggsave("advertised-bandwidths-requirement.png", width = 8, height = 6,
- dpi = 100)
-
t <- data
t1 <- t[t$min_rate == 11875 & t$ports == "80-443-554-1755" &
- t$min_advbw == 5000, ]
+ t$min_advbw == 5000 & t$same_network == TRUE, ]
t2 <- t[t$min_rate == 10000 & t$ports == "80-443" &
- t$min_advbw == 2000, ]
-t <- rbind(data.frame(t1, var = "95+ Mbit/s, 5000+ KB/s, 80/443/554/1755"),
+ t$min_advbw == 2000 & t$same_network == FALSE, ]
+t <- rbind(data.frame(t1, var = paste("95+ Mbit/s, 5000+ KB/s,",
+ "80/443/554/1755, 2- per /24")),
data.frame(t2, var = "80+ Mbit/s, 2000+ KB/s, 80/443"))
t <- aggregate(list(relays = t$relays, P_exit = 100 * t$exit_prob),
by = list(date = as.Date(cut.Date(as.Date(t$valid_after), DETAIL)),
diff --git a/task-6498/src/Main.java b/task-6498/src/Main.java
index 99e991b..8b24649 100644
--- a/task-6498/src/Main.java
+++ b/task-6498/src/Main.java
@@ -64,7 +64,8 @@ public class Main {
BufferedWriter bw = new BufferedWriter(new FileWriter(resultsFile,
true));
if (writeHeader) {
- bw.write("valid_after,min_rate,min_advbw,ports,relays,exit_prob\n");
+ bw.write("valid_after,min_rate,min_advbw,ports,same_network,relays,"
+ + "exit_prob\n");
}
while (descriptorFiles.hasNext()) {
DescriptorFile descriptorFile = descriptorFiles.next();
@@ -184,17 +185,11 @@ public class Main {
* consider the fastest 2 relays per /24 with respect to exit
* probability. Also vary requirements. Overall, analyze these
* settings:
- * - rate >= 11875, advbw >= 5000, exit to 80, 443, 554, 1755
- * - rate >= 11875, advbw >= 5000, exit to 80, 443
- * - rate >= 11875, advbw >= 4000, exit to 80, 443, 554, 1755
- * - rate >= 11875, advbw >= 3000, exit to 80, 443, 554, 1755
- * - rate >= 11875, advbw >= 2000, exit to 80, 443, 554, 1755
- * - rate >= 11875, advbw >= 1000, exit to 80, 443, 554, 1755
+ * - rate >= 11875, advbw >= 5000, exit to 80, 443, 554, 1755,
+ * at most 2 relays per /24
* - rate >= 10000, advbw >= 2000, exit to 80, 443 */
- int[] minimumBandwidthRates = new int[] { 11875, 11875, 11875,
- 11875, 11875, 11875, 10000 };
- int[] minimumAdvertisedBandwidths = new int[] { 5000, 5000, 4000,
- 3000, 2000, 1000, 2000 };
+ int[] minimumBandwidthRates = new int[] { 11875, 10000 };
+ int[] minimumAdvertisedBandwidths = new int[] { 5000, 2000 };
Set<Integer> defaultPorts = new HashSet<Integer>();
defaultPorts.add(80);
defaultPorts.add(443);
@@ -206,15 +201,12 @@ public class Main {
List<Set<Integer>> requiredPorts = new ArrayList<Set<Integer>>();
requiredPorts.add(defaultPorts);
requiredPorts.add(reducedPorts);
- requiredPorts.add(defaultPorts);
- requiredPorts.add(defaultPorts);
- requiredPorts.add(defaultPorts);
- requiredPorts.add(defaultPorts);
- requiredPorts.add(reducedPorts);
+ boolean[] sameNetworks = new boolean[] { true, false };
for (int i = 0; i < minimumBandwidthRates.length; i++) {
int minimumBandwidthRate = minimumBandwidthRates[i];
int minimumAdvertisedBandwidth = minimumAdvertisedBandwidths[i];
Set<Integer> minimumRequiredPorts = requiredPorts.get(i);
+ boolean sameNetwork = sameNetworks[i];
Map<String, List<Double>> exitWeightFractionsByAddressParts =
new HashMap<String, List<Double>>();
for (String fingerprint : fingerprints) {
@@ -242,9 +234,11 @@ public class Main {
int totalRelays = 0;
for (List<Double> weightFractions :
exitWeightFractionsByAddressParts.values()) {
- Collections.sort(weightFractions);
- while (weightFractions.size() > 2) {
- weightFractions.remove(0);
+ if (sameNetwork) {
+ Collections.sort(weightFractions);
+ while (weightFractions.size() > 2) {
+ weightFractions.remove(0);
+ }
}
for (double weightFraction : weightFractions) {
totalExitWeightFraction += weightFraction;
@@ -259,10 +253,11 @@ public class Main {
* - ports: "80-443" or "80-443-554-1755"
* - relays: number of relays matching the requirements
* - exit_prob: sum of exit probabilities */
- bw.write(String.format("%s,%d,%d,%s,%d,%.4f%n",
+ bw.write(String.format("%s,%d,%d,%s,%s,%d,%.4f%n",
validAfter, minimumBandwidthRate,
minimumAdvertisedBandwidth, minimumRequiredPorts.size() <= 2
- ? "80-443" : "80-443-554-1755", totalRelays,
+ ? "80-443" : "80-443-554-1755",
+ sameNetwork ? "TRUE" : "FALSE", totalRelays,
totalExitWeightFraction));
}
}