-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.R
136 lines (119 loc) · 4.12 KB
/
main.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
##############################################################
# ExecuteJMetal ::R functions::
#
# Author: Lucas Prestes lucas.prestes.lp@gmail.com
#
# https://github.com/LucasLP/ExecuteJMetal
#
#
#
dataDirectory <- "/data/"
#### Functions avaible ####
#
# loadData(algorithm, instance) #Return the data file from instance ant indicator
# setBenchmark(benchmark)
# bestHV(algorithm, instance)
# bestIGD(algorithm, instance)
# bestEP(algorithm, instance)
# bestIndicators(algorithm, instance)
# setBenchmark(benchmark) #example, send "UF" and it will return a array with all of instances in this benchmark
#
source("./Statistics/Counter.R")
# countWinners(algorithms, instances)
# countAll(algorithm, instance)
# countAllinBenchmark(algorithm, benchmark)
#
#
#
source("./Statistics/MeanAndStandardDeviation.R")
# meanAndStandardDeviationTable(OutputFile, algorithms, problems, indicator) #tex
#
source("./Tex/latexFunctions.R")
# #### LATEX FUNCTIONS ####
# latexCreate(file)
# latexHeader(file)
# latexNewSection(file, section)
# latexTail(file)
# latexTableHeader(OutputFile,indicator, caption, tabularString, latexTableFirstLine)
# latexTableLine(file, line, best)
# latexTableTail(file)
# latexWinnersTable(file, problem, algorithms)
# winnerTables(algorithms, benchmarks) #this files generate a tex file of winner algorithms
#
source("./Plots/ScatterPlot.R")
# #### POINT & LINE CHART ####
# objectivePoints(instanceName, algorithmsNames)
# objectivePoints3D(instanceName, algorithmsNames)
source("./Plots/LinePlot.R")
# linePlotEvolution(instance, indicator, algorithmsNames)
#
#
#
#
source("./Statistics/Kruskal.R")
# #### Kruskall-Wallis ####
# KruskallWallisTest(algorithms, instance,indicator) #this will print in terminal the comparison of all algorithms
# kruskalMain(algorithms,problems,indicator)
#
# #### R functions of JMetal (modified) ####
#
source("./Statistics/Wilcoxon.R")
# wilcoxonMain(algorithms,problems,indicator)
#
source("./Plots/BoxPlot.R")
# JMetalBoxplot(algorithms, indicator, problem)
#
#
source("./Tex/latexStatisticalTests.R")
# latexMain(algorithms, benchmark)
##############################################################
loadData <- function(algorithm, instance, indicator){
path <- paste(dataDirectory,algorithm, "/",instance,"/",indicator, sep="")
return (read.table(path, header=FALSE))
}
#return the index of max hypervolum of instance in algorithm
bestHV <- function(algorithm, instance){
hv <- loadData(algorithm, instance,"HV")
hvMax <- which(hv == max(hv))
return (list(algorithm, instance, hvMax, max(hv)))
}
#return the index of min IGD of instance in algorithm
bestIGD <- function(algorithm, instance){
igd <- loadData(algorithm, instance,"IGD")
igdMin <- which(igd == min(igd))
return (list(algorithm, instance, igdMin, min(igd)))
}
#return the index of min Epsilon of instance in algorithm
bestEP <- function(algorithm, instance){
ep <- loadData(algorithm, instance,"EP")
epMin <- which(ep == min(ep))
return (list(algorithm, instance, epMin, min(ep)))
}
bestIndicators <- function(algorithm, instance){
hv <- loadData(algorithm, instance,"HV")
igd <- loadData(algorithm, instance,"IGD")
ep <- loadData(algorithm, instance,"EP")
hvMax <- which(hv == max(hv))
igdMin <- which(igd == min(igd))
epMin <- which(ep == min(ep))
return (list(algorithm, max(hv), min(igd), min(ep)))
}
#return instances of a benchmark
setBenchmark <- function(benchmark){
if(benchmark=="UF"){
return (c("UF1", "UF2", "UF3", "UF4", "UF5", "UF6", "UF7", "UF8", "UF9", "UF10"))
}else if(benchmark=="GLT"){
return (c("GLT1", "GLT2", "GLT3", "GLT4", "GLT5"))
}else if(benchmark=="LZ09"){
return (c("LZ09F1", "LZ09F2", "LZ09F3", "LZ09F4", "LZ09F5", "LZ09F6", "LZ09F7", "LZ09F8", "LZ09F9"))
}else if(benchmark=="WFG"){
return (c("WFG1", "WFG2", "WFG3", "WFG4", "WFG5", "WFG6", "WFG7", "WFG8", "WFG9"))
}else if(benchmark=="ZDT"){
return (c("ZDT1", "ZDT2", "ZDT3", "ZDT4", "ZDT6"))#ZDT5
}else if(benchmark=="DTLZ"){
return (c("DTLZ1", "DTLZ2", "DTLZ3", "DTLZ4", "DTLZ6", "DTLZ7"))#DTLZ5
}else if(benchmark=="MOP"){
return (c("MOP1", "MOP2", "MOP3", "MOP4", "MOP5", "MOP6", "MOP7"))
}
return (c())
}