Skip to content

Commit

Permalink
Merge pull request #107 from IOHprofiler/EAF_Plots
Browse files Browse the repository at this point in the history
[1.8.0] EAF-based plots
  • Loading branch information
Dvermetten authored Sep 20, 2023
2 parents 0ce9079 + 7073928 commit 5b83fcc
Show file tree
Hide file tree
Showing 41 changed files with 1,738 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: '4.2'}
- {os: macOS-10.15, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

Expand Down
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: IOHanalyzer
Type: Package
Title: Data Analysis Part of 'IOHprofiler'
Version: 0.1.7.4
Version: 0.1.8.2
Maintainer: Diederick Vermetten <d.l.vermetten@liacs.leidenuniv.nl>
Authors@R: c(
person("Hao", "Wang", email = "h.wang@liacs.leidenuniv.nl", role = "aut", comment = c(ORCID = "0000-0002-4933-5181")),
Expand All @@ -17,7 +17,7 @@ Description: The data analysis module for the Iterative Optimization Heuristics
License: BSD_3_clause + file LICENSE
Encoding: UTF-8
LazyData: true
URL: http://iohprofiler.liacs.nl, https://github.com/IOHprofiler/IOHAnalyzer
URL: https://iohanalyzer.liacs.nl, https://github.com/IOHprofiler/IOHAnalyzer
BugReports: https://github.com/IOHprofiler/IOHAnalyzer/issues
Imports:
magrittr,
Expand All @@ -34,9 +34,11 @@ Imports:
httr,
knitr,
methods,
rjson
rjson,
eaf,
viridis
LinkingTo: Rcpp
SystemRequirements: C++11
SystemRequirements: C++
RoxygenNote: 7.1.2
Suggests:
Rcpp,
Expand Down
17 changes: 17 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ export(fast_RT_samples)
export(generate_data.AUC)
export(generate_data.Aggr)
export(generate_data.CDP)
export(generate_data.EAF)
export(generate_data.EAF_Difference)
export(generate_data.EAF_diff_Approximate)
export(generate_data.ECDF)
export(generate_data.ECDF_From_EAF)
export(generate_data.ECDF_raw)
export(generate_data.Heatmaps)
export(generate_data.PMF)
Expand Down Expand Up @@ -161,6 +165,8 @@ export(glicko2_ranking)
export(max_ERTs)
export(mean_FVs)
export(pairwise.test)
export(plot_eaf_data)
export(plot_eaf_differences)
export(plot_general_data)
export(read_IOH_v1plus)
export(read_index_file)
Expand All @@ -183,15 +189,20 @@ importFrom(data.table,copy)
importFrom(data.table,data.table)
importFrom(data.table,frank)
importFrom(data.table,fread)
importFrom(data.table,getDTthreads)
importFrom(data.table,is.data.table)
importFrom(data.table,melt)
importFrom(data.table,rbindlist)
importFrom(data.table,setDT)
importFrom(data.table,setDTthreads)
importFrom(data.table,setnames)
importFrom(data.table,setorder)
importFrom(data.table,setorderv)
importFrom(data.table,transpose)
importFrom(dplyr,"%>%")
importFrom(dplyr,mutate)
importFrom(eaf,eafdiff)
importFrom(eaf,eafs)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_text)
importFrom(ggplot2,facet_wrap)
Expand Down Expand Up @@ -226,8 +237,12 @@ importFrom(magrittr,set_names)
importFrom(magrittr,set_rownames)
importFrom(methods,hasArg)
importFrom(plotly,add_annotations)
importFrom(plotly,add_contour)
importFrom(plotly,add_polygons)
importFrom(plotly,add_trace)
importFrom(plotly,animation_opts)
importFrom(plotly,colorbar)
importFrom(plotly,hide_colorbar)
importFrom(plotly,layout)
importFrom(plotly,orca)
importFrom(plotly,plot_ly)
Expand All @@ -254,10 +269,12 @@ importFrom(stringi,stri_locate_all)
importFrom(stringi,stri_rand_strings)
importFrom(stringi,stri_replace)
importFrom(stringi,stri_sub)
importFrom(utils,compareVersion)
importFrom(utils,data)
importFrom(utils,head)
importFrom(utils,read.csv)
importFrom(utils,tail)
importFrom(utils,type.convert)
importFrom(utils,write.csv)
importFrom(viridis,viridis)
useDynLib(IOHanalyzer)
29 changes: 10 additions & 19 deletions R/DataSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,16 @@ DataSet <- function(info, verbose = F, maximization = NULL, format = IOHprofiler
tdatFile <- file.path(path, paste0(datBaseName, '.tdat'))
cdatFile <- file.path(path, paste0(datBaseName, '.cdat'))

# NOTE: preference on data file for the alignment by RT: cdat > tdat > dat
if (file.exists(cdatFile))
fvFile <- cdatFile
else if (file.exists(tdatFile))
fvFile <- tdatFile
else if (file.exists(datFile))
fvFile <- datFile
else
stop('No datafiles found, please verify the integrity of the chosen files')

# NOTE: preference on data file for the alignment by FV: dat > tdat > cdat
# NOTE: preference on data file from coco: dat > tdat > cdat
if (file.exists(datFile))
rtFile <- datFile
else if (file.exists(tdatFile))
rtFile <- tdatFile
else if (file.exists(cdatFile))
# TODO: perhaps turn on `subsampling` here as this would take quite some time
rtFile <- cdatFile
else
stop('No datafiles found, please verify the integrity of the chosen files')

read_raw <- switch(
format,
Expand All @@ -101,22 +93,21 @@ DataSet <- function(info, verbose = F, maximization = NULL, format = IOHprofiler
)

RT_raw <- read_raw(rtFile, subsampling)
FV_raw <- read_raw(fvFile, subsampling)

if (is.null(maximization)) {
if (verbose)
warning("Did not find maximization / minimization, auto-detecting based on
function value progression")
# TODO: idxTarget should be set depending on the data format
idxTarget <- 2
cond <- unique(lapply(FV_raw, function(FV) FV[1, idxTarget] >= FV[nrow(FV), idxTarget]))
cond <- unique(lapply(RT_raw, function(FV) FV[1, idxTarget] >= FV[nrow(FV), idxTarget]))
if (length(cond) > 1)
stop('The detected maximization differs in multiple runs')
maximization <- cond
}

RT <- align_running_time(RT_raw, format = format, maximization = maximization)
FV <- align_function_value(FV_raw, format = format)
FV <- align_function_value(RT_raw, format = format)

PAR <- list(
'by_FV' = RT[names(RT) != 'RT'],
Expand Down Expand Up @@ -148,9 +139,9 @@ DataSet <- function(info, verbose = F, maximization = NULL, format = IOHprofiler
# TODO: clean up these if-statements: Function to set idxTarget and n_data_column?
# `idxTarget` is a global variable?
if (format == TWO_COL)
finalFV <- set_names(sapply(FV_raw, function(d) d[nrow(d), idxTarget - 1]), NULL)
finalFV <- set_names(sapply(RT_raw, function(d) d[nrow(d), idxTarget - 1]), NULL)
else
finalFV <- set_names(sapply(FV_raw, function(d) d[nrow(d), idxTarget]), NULL)
finalFV <- set_names(sapply(RT_raw, function(d) d[nrow(d), idxTarget]), NULL)

if (any(finalFV != info$finalFV) && verbose)
warning('Inconsitent finalFvalue in *.info file and *.dat file')
Expand All @@ -168,9 +159,9 @@ DataSet <- function(info, verbose = F, maximization = NULL, format = IOHprofiler
maximization = maximization, suite = suite, ID = info$algId))
)
if (isTRUE(info$constrained) || full_sampling) {
FV_raw_mat <- matrix(nrow = nrow(FV), ncol = length(FV_raw))
for (idx in seq(length(FV_raw))) {
FV_raw_mat[,idx] = FV_raw[[idx]][,2]
FV_raw_mat <- matrix(nrow = nrow(FV), ncol = length(RT_raw))
for (idx in seq(length(RT_raw))) {
FV_raw_mat[,idx] = RT_raw[[idx]][,2]
}
temp$FV_raw_mat <- FV_raw_mat
attr(temp, 'contains_full_FV') <- TRUE
Expand Down
Loading

0 comments on commit 5b83fcc

Please sign in to comment.