Skip to content
Permalink
Browse files

Add all data for Alteration Predictive Hybrid Search thesis

  • Loading branch information...
Kurt Micheli
Kurt Micheli committed Sep 12, 2018
1 parent ed6c6fe commit 797111723c39577e4fcdda6627d3e1cf751293e6
Showing with 15,316,815 additions and 1 deletion.
  1. +19 −0 OPMPHM/README.md
  2. +1 −0 OPMPHM/mapping/.gitignore
  3. +30 −0 OPMPHM/mapping/Makefile
  4. +165 −0 OPMPHM/mapping/analyze_all.R
  5. +57 −0 OPMPHM/mapping/analyze_allSeeds.R
  6. +98 −0 OPMPHM/mapping/analyze_opt.R
  7. +102 −0 OPMPHM/mapping/analyze_single.R
  8. +11 −0 OPMPHM/mapping/data_all_seeds_mapping_benchmark/benchmark_opmphm_mapping_allSeeds.csv
  9. +7 −0 OPMPHM/mapping/data_all_seeds_mapping_benchmark/benchmark_opmphm_mapping_allSeeds.seeds
  10. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping2_1.csv
  11. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping2_1.seeds
  12. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping3_1.csv
  13. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping3_1.seeds
  14. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping3_2.csv
  15. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping3_2.seeds
  16. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping3_3.csv
  17. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping3_3.seeds
  18. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping4_1.csv
  19. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping4_1.seeds
  20. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping4_2.csv
  21. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping4_2.seeds
  22. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping4_3.csv
  23. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping4_3.seeds
  24. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping5_1.csv
  25. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping5_1.seeds
  26. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping5_2.csv
  27. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping5_2.seeds
  28. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping5_3.csv
  29. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping5_3.seeds
  30. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping6_1.csv
  31. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping6_1.seeds
  32. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping6_2.csv
  33. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping6_2.seeds
  34. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping6_3.csv
  35. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping6_3.seeds
  36. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping7_1.csv
  37. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping7_1.seeds
  38. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping7_2.csv
  39. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping7_2.seeds
  40. +11 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping7_3.csv
  41. +12,400 −0 OPMPHM/mapping/data_mapping_benchmark/benchmark_opmphm_mapping7_3.seeds
  42. +93,920 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_mapping_opt_1.seeds
  43. +93,920 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_mapping_opt_2.seeds
  44. +93,920 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_mapping_opt_3.seeds
  45. +93,920 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_mapping_opt_4.seeds
  46. +93,920 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_mapping_opt_5.seeds
  47. +11 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_opmphm_mapping_opt_1.csv
  48. +11 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_opmphm_mapping_opt_2.csv
  49. +11 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_opmphm_mapping_opt_3.csv
  50. +11 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_opmphm_mapping_opt_4.csv
  51. +11 −0 OPMPHM/mapping/data_optimal_mapping_benchmark/benchmark_opmphm_mapping_opt_5.csv
  52. +88 −0 OPMPHM/mapping/output_spacecomplexity.R
  53. +1 −0 OPMPHM/time/.gitignore
  54. +21 −0 OPMPHM/time/Makefile
  55. +103 −0 OPMPHM/time/analyze_compare.R
  56. +117 −0 OPMPHM/time/analyze_opmphm_vs_binary.R
  57. +108 −0 OPMPHM/time/analyze_prediction_faster_count.R
  58. +122 −0 OPMPHM/time/analyze_prediction_faster_factor.R
  59. +54,600 −0 OPMPHM/time/data/benchmark_binary_search_time.seeds
  60. +1,400 −0 OPMPHM/time/data/benchmark_hsearch_build_time.seeds
  61. +1,757 −0 OPMPHM/time/data/benchmark_opmphm_build_time.seeds
  62. +54,600 −0 OPMPHM/time/data/benchmark_opmphm_search_time.seeds
  63. +3,496,500 −0 OPMPHM/time/data/benchmark_prediction_time_11.seeds
  64. +3,496,500 −0 OPMPHM/time/data/benchmark_prediction_time_5.seeds
  65. +3,496,500 −0 OPMPHM/time/data/benchmark_prediction_time_7.seeds
  66. +3,496,500 −0 OPMPHM/time/data/benchmark_prediction_time_9.seeds
  67. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time0.csv
  68. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time1.csv
  69. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time2.csv
  70. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time3.csv
  71. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time4.csv
  72. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time5.csv
  73. +41 −0 OPMPHM/time/data/system_0/benchmark_binary_search_time7.csv
  74. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time0.csv
  75. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time1.csv
  76. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time2.csv
  77. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time3.csv
  78. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time4.csv
  79. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time5.csv
  80. +801 −0 OPMPHM/time/data/system_0/benchmark_hsearch_build_time7.csv
  81. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time0.csv
  82. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time1.csv
  83. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time2.csv
  84. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time3.csv
  85. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time4.csv
  86. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time5.csv
  87. +10,201 −0 OPMPHM/time/data/system_0/benchmark_opmphm_build_time7.csv
  88. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time0.csv
  89. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time1.csv
  90. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time2.csv
  91. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time3.csv
  92. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time4.csv
  93. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time5.csv
  94. +41 −0 OPMPHM/time/data/system_0/benchmark_opmphm_search_time7.csv
  95. +34,966 −0 OPMPHM/time/data/system_0/benchmark_prediction_time1.csv
  96. +34,966 −0 OPMPHM/time/data/system_0/benchmark_prediction_time127.csv
  97. +34,966 −0 OPMPHM/time/data/system_0/benchmark_prediction_time31.csv
  98. +34,966 −0 OPMPHM/time/data/system_0/benchmark_prediction_time7.csv
  99. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time0.csv
  100. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time1.csv
  101. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time2.csv
  102. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time3.csv
  103. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time4.csv
  104. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time5.csv
  105. +41 −0 OPMPHM/time/data/system_1/benchmark_binary_search_time7.csv
  106. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time0.csv
  107. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time1.csv
  108. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time2.csv
  109. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time3.csv
  110. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time4.csv
  111. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time5.csv
  112. +801 −0 OPMPHM/time/data/system_1/benchmark_hsearch_build_time7.csv
  113. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time0.csv
  114. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time1.csv
  115. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time2.csv
  116. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time3.csv
  117. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time4.csv
  118. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time5.csv
  119. +15,301 −0 OPMPHM/time/data/system_1/benchmark_opmphm_build_time7.csv
  120. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time0.csv
  121. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time1.csv
  122. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time2.csv
  123. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time3.csv
  124. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time4.csv
  125. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time5.csv
  126. +41 −0 OPMPHM/time/data/system_1/benchmark_opmphm_search_time7.csv
  127. +17,606 −0 OPMPHM/time/data/system_1/benchmark_prediction_time1.csv
  128. +17,606 −0 OPMPHM/time/data/system_1/benchmark_prediction_time127.csv
  129. +17,606 −0 OPMPHM/time/data/system_1/benchmark_prediction_time31.csv
  130. +17,606 −0 OPMPHM/time/data/system_1/benchmark_prediction_time7.csv
  131. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time0.csv
  132. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time1.csv
  133. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time2.csv
  134. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time3.csv
  135. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time4.csv
  136. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time5.csv
  137. +41 −0 OPMPHM/time/data/system_2/benchmark_binary_search_time7.csv
  138. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time0.csv
  139. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time1.csv
  140. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time2.csv
  141. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time3.csv
  142. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time4.csv
  143. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time5.csv
  144. +801 −0 OPMPHM/time/data/system_2/benchmark_hsearch_build_time7.csv
  145. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time0.csv
  146. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time1.csv
  147. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time2.csv
  148. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time3.csv
  149. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time4.csv
  150. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time5.csv
  151. +10,201 −0 OPMPHM/time/data/system_2/benchmark_opmphm_build_time7.csv
  152. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time0.csv
  153. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time1.csv
  154. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time2.csv
  155. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time3.csv
  156. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time4.csv
  157. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time5.csv
  158. +41 −0 OPMPHM/time/data/system_2/benchmark_opmphm_search_time7.csv
  159. +17,606 −0 OPMPHM/time/data/system_2/benchmark_prediction_time1.csv
  160. +17,606 −0 OPMPHM/time/data/system_2/benchmark_prediction_time127.csv
  161. +17,606 −0 OPMPHM/time/data/system_2/benchmark_prediction_time31.csv
  162. +17,606 −0 OPMPHM/time/data/system_2/benchmark_prediction_time7.csv
  163. +1 −1 README.md
@@ -0,0 +1,19 @@
This folder contains all data and results of the Alteration Predictive Hybrid Search
thesis.

The Runtime of the OPMPHM Build data is in the `mapping` folder.
The OPMPHM Build vs Hsearch Build and The Hybrid Search data is in the `time` folder.

All the in the benchmarked used seeds are in the `data*` folders as `*.seeds` files stored.
The results are in csv format and also in the `data*` folders.

The time benchmarks where made on different systems, the syntax is as follows:

| foldername | Hardware |
| ------------- |------------|
| system_0 | i7-6700K |
| system_1 | i7-3517U |
| system_2 | 1800X |

Each folder contains R files and a Makefile that evaluates the results and constructs the charts.
The charts when constructed are in the `output` folder as `tex` files stored.
@@ -0,0 +1 @@
output
@@ -0,0 +1,30 @@
#!/bin/bash

all: opt allSeeds all_a space single

opt: output
./analyze_opt.R
allSeeds: output
./analyze_allSeeds.R
all_a: output
./analyze_all.R
space: output
./output_spacecomplexity.R
single: s2 s3 s4 s5 s6 s7

s2: output
./analyze_single.R 2
s3: output
./analyze_single.R 3
s4: output
./analyze_single.R 4
s5: output
./analyze_single.R 5
s6: output
./analyze_single.R 6
s7: output
./analyze_single.R 7
output:
mkdir output
clean:
rm -rf output
@@ -0,0 +1,165 @@
#!/usr/bin/env Rscript

if(!require (ggplot2)) install.packages ('ggplot2', dep = TRUE, repos = "http://cran.us.r-project.org")
if(!require (tikzDevice)) install.packages ('tikzDevice', dep = TRUE, repos = "http://cran.us.r-project.org")

library (ggplot2)
library (scales)
library (grid)
library (tikzDevice)

integerEqual <- function (a, b)
{
return (identical (as.integer (a), as.integer (b)))
}

optR <- function (n)
{
r = ifelse (n < 15, 6, ifelse (n < 30, 5, ifelse (n < 240, 4, 3)))
return (r)
}

labelFunction <- function (n)
{
return (paste(n,optR(n),sep = "\n"))
}

#~ max Mapping invocations
maxMappings <- 10

#~ load data

parts <- c (0, 1, 3, 3, 3, 3, 3)
rUinPar <- 3:7

inputDatas <- list()

for (r in rUinPar)
{
inputDataPart <- list()
for (p in 1:parts[r])
{
inputDataPart[[p]] <- read.csv (sprintf ("data_mapping_benchmark/benchmark_opmphm_mapping%i_%i.csv", r, p), header = TRUE, sep = ";")
}
inputDatas[[r]] <- inputDataPart
}

# merge
for (r in rUinPar)
{
if (!integerEqual (parts[r], 1))
{
for (p in 2:parts[r])
{
for (cI in 2:ncol (inputDatas[[r]][[1]]))
{
for (rI in 1:nrow (inputDatas[[r]][[1]]))
{
inputDatas[[r]][[1]][rI,cI] <- inputDatas[[r]][[1]][rI,cI] + inputDatas[[r]][[p]][rI,cI]
}
}
}
}
}

# analyse
data <- data.frame (n = integer(), c = numeric(), r = integer(), costs = integer(), q = integer())
id <- 0
# all have same n but not c
cValues <- list ()
nValues <- list ()

for (r in rUinPar)
{
# process
print (r)
cValues[[r]] <- list()
for (cI in 2:ncol (inputDatas[[r]][[1]]))
{
# expand data
colData <- c ()
for (rI in 1:nrow (inputDatas[[r]][[1]]))
{
colData <- c (colData, rep (rI,inputDatas[[r]][[1]][rI,cI]))
}
# parse n and c
colName <- strsplit (colnames (inputDatas[[r]][[1]])[cI], "c_")
nIndex <- as.integer(substring (colName[[1]][1], first=3))
cIndex <- as.numeric(colName[[1]][2])
# save c and n
if (!nIndex %in% nValues)
{
nValues[[length(nValues) + 1]] <- nIndex
}
if (!cIndex %in% cValues[[r]])
{
cValues[[r]][[length(cValues[[r]]) + 1]] <- cIndex
}

# actual analyse
q <- quantile (colData, 0.995)

# if quantile is maxMappings than the result in incorrect
if (!integerEqual (q, maxMappings))
{
data <- rbind (data, c (nIndex, cIndex, r, nIndex * r * q, q))
}
}
}

colnames (data) <- c ("n", "c", "r", "costs", "q")

dataMin <- lapply(lapply(split(data,data$n),function(chunk) chunk[order(chunk$c),]),function(chunk) chunk[which.min(chunk$costs),])
dataAll <- lapply(lapply(split(data,data$n),function(chunk) chunk[order(chunk$c),]),function(chunk) chunk[order(chunk$costs),])

#~ print (dataAll)
#~ print (dataMin)

# extract a new data frame, based on the opmphmOptR(R)
drawData <- subset (data, (r == 6 & n <= 15) | (r == 5 & n >= 15 & n <= 30) | (r == 4 & n >= 30 & n <= 240) | (r == 3 & n >= 240))

# move interval end to not intercept other interval start
for (i in 1:nrow (drawData))
{
# drawData[i,1] = n
# drawData[i,3] = r
if (integerEqual (drawData[i,3], 6) & integerEqual (drawData[i,1], 15))
{
drawData[i,1] <- drawData[i,1] - 2
}
# log scale overlaps
if (integerEqual (drawData[i,3], 5) & integerEqual (drawData[i,1], 30))
{
drawData[i,1] <- drawData[i,1] - 4
}
if (integerEqual (drawData[i,3], 4) & integerEqual (drawData[i,1], 240))
{
drawData[i,1] <- drawData[i,1] - 30
}
}

lineData0 <- data.frame(x=10, xend=15, y=3, yend=3)
lineData1 <- data.frame(x=15, xend=30, y=2.45, yend=1.95)
lineData2 <- data.frame(x=30, xend=240, y=2.35, yend=1.45)
lineData3 <- data.frame(x=240, xend=1280, y=2.25, yend=1.35)

outputFileName <- "output/all_mapping_benchmark.tex"

tikz(file = outputFileName, width = 4.8, height = 4, engine = "pdftex")

plot <- ggplot (drawData, aes (y = c, x = n)) +
geom_point (show.legend = FALSE, size=5, color="black") +
geom_point (aes (color = factor (q,ordered=TRUE)), show.legend = FALSE, size=4.5) +
scale_color_grey (start=1, end=0.1) +
geom_text (aes(label=q), size=3) +
geom_segment(data=lineData0, aes(x=x, xend=xend, y=y, yend=yend), size=1) +
geom_segment(data=lineData1, aes(x=x, xend=xend, y=y, yend=yend), size=1) +
geom_segment(data=lineData2, aes(x=x, xend=xend, y=y, yend=yend), size=1) +
geom_segment(data=lineData3, aes(x=x, xend=xend, y=y, yend=yend), size=1) +
scale_x_continuous (name = "n\nr", trans = "log2", breaks = unlist (unique (nValues)), labels = labelFunction) +
#~ scale_y_continuous (name = "c", breaks = round(seq(min(unlist(cValues)), max(unlist(cValues)), by = 0.1),2) +
scale_y_continuous (name = "c") +
theme_classic ()

print(plot)
dev.off()
@@ -0,0 +1,57 @@
#!/usr/bin/env Rscript

if(!require (ggplot2)) install.packages ('ggplot2', dep = TRUE, repos = "http://cran.us.r-project.org")
if(!require (tikzDevice)) install.packages ('tikzDevice', dep = TRUE, repos = "http://cran.us.r-project.org")

library (ggplot2)
library (scales)
library (grid)
library (tikzDevice)

#~ max Mapping invocations
maxMappings <- 4

labelFunction <- function (s)
{
#~ n <- ifelse (s == 1, 9, ifelse (s == 6, 29, ifelse (s == 11, 49, 0)))
n <- ifelse (s == 1, 9, ifelse (s == 6, 29, ifelse (s == 11, 49, ifelse (s == 16, 69, ifelse (s == 21, 89, ifelse (s == 26, 109, ifelse (s == 31, 129, 0)))))))
s <- s %% (maxMappings + 1)
return (ifelse (n == 0, s, (paste(s,n,sep = "\n"))))
}

#~ load data
inputData <- read.csv ("data_all_seeds_mapping_benchmark/benchmark_opmphm_mapping_allSeeds.csv", header = TRUE, sep = ";")

data <- data.frame (n = integer(), trails = integer(), show = integer(), count = integer())

showValues <- list()

for (cI in 2:ncol (inputData))
{
# parse n
colName <- strsplit (colnames (inputData)[cI], "r_")
nIndex <- as.integer(substring (colName[[1]][1], first=3))

# unite data
for (rI in 1:maxMappings)
{
count <- inputData[rI,cI]
data <- rbind (data, c (nIndex, rI, rI + (cI - 2) * (maxMappings + 1), count))
showValues[length(showValues) + 1] = rI + (cI - 2) * (maxMappings + 1)
}
}

colnames (data) <- c ("n", "trails", "show", "count")

outputFileName <- sprintf ("output/all_seeds_mapping_benchmark.tex", nIndex)

tikz(file = outputFileName, width = 4.26, height = 3.2, engine = "pdftex")

plot <- ggplot (data, aes (y = count, x = show)) +
geom_bar (stat="identity", fill="black") +
scale_x_continuous (name = "hypergraphs\nKeyset size ($n$)", breaks = unlist (showValues), labels = labelFunction) +
theme_bw ()

print(plot)

dev.off()
@@ -0,0 +1,98 @@
#!/usr/bin/env Rscript

if(!require (ggplot2)) install.packages ('ggplot2', dep = TRUE, repos = "http://cran.us.r-project.org")
if(!require (tikzDevice)) install.packages ('tikzDevice', dep = TRUE, repos = "http://cran.us.r-project.org")

library (ggplot2)
library (scales)
library (grid)
library (tikzDevice)

integerEqual <- function (a, b)
{
return (identical (as.integer (a), as.integer (b)))
}

#~ max Mapping invocations
maxMappings <- 10

#~ load parts
parts <- 5

inputDatas <- list()

for (i in 1:parts)
{
inputDatas[[i]] <- read.csv (sprintf ("data_optimal_mapping_benchmark/benchmark_opmphm_mapping_opt_%i.csv", i), header = TRUE, sep = ";")
}

# merge

inputData <- inputDatas[[1]]

for (cI in 2:ncol (inputData))
{
if (!integerEqual (parts, 1))
{
for (p in 2:parts)
{
for (rI in 1:nrow (inputData))
{
inputData[rI,cI] <- inputData[rI,cI] + inputDatas[[p]][rI,cI]
}
}
}
}

# analyse

data <- data.frame (n = integer(), r = integer(), c = numeric (), q = integer(), max = integer())

for (cI in 2:ncol (inputData))
{
# process
print(cI)
# expand data
colData <- c ()
for (rI in 1:nrow (inputData))
{
colData <- c (colData, rep (rI,inputData[rI,cI]))
}
# parse n, r and c
colName <- strsplit (colnames (inputData)[cI], "r_")
nIndex <- as.integer(substring (colName[[1]][1], first=3))
colName <- strsplit (colName[[1]][2], "c_")
rIndex <- as.integer (colName[[1]][1])
cIndex <- as.numeric (colName[[1]][2])

# actual analyse
q <- quantile (colData, 0.995)
max <- max (colData)

# if quantile is maxMappings than the result in incorrect
if (!integerEqual (q, maxMappings))
{
data <- rbind (data, c (nIndex, rIndex, cIndex, q, max))
}
}

colnames (data) <- c ("n", "r", "c", "q", "max")

outputFileName <- "output/optimal_mapping_benchmark.tex"

tikz(file = outputFileName, width = 4.26, height = 3.2, engine = "pdftex")

plot <- ggplot (data, aes (x = n)) +
geom_line (aes (y = q, color="q")) +
geom_line (aes (y = max, color="max")) +
scale_color_manual (values = c ("q" = "black", "max" = "gray"), breaks = c ("q", "max"), labels = c ("$x_{n,0.995}$", "$max_n$")) +
scale_x_continuous (name = "Keyset size ($n$)", breaks = seq (0, 13000, by = 100), limit = c(0,1300)) +
scale_y_continuous (name = "hypergraphs", breaks = seq(1, 7, by = 1), limit = c(1,7)) +
theme_bw () +
theme(legend.position="bottom",
panel.border = element_rect(colour = "black", fill=NA),
legend.box.background = element_rect(colour = "black"),
legend.title = element_blank ())

print(plot)
dev.off()

0 comments on commit 7971117

Please sign in to comment.
You can’t perform that action at this time.