plot.func.ert: Plot ERT Functions

Description Usage Arguments Value Examples

Description

Plot the Expected Running Time (ERT) functions for a couple of different datasets.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'func.ert'
plot(x, goal.dim = 2L, time.dim = 1L,
  time.type = as.integer, goal.type = as.numeric,
  goal.min = goal.type(NA_real_), goal.max = goal.type(NA_real_),
  time.max = time.type(NA_real_), extract.run = identity,
  extract.runs = identity, comparator = `<=`,
  lineTypeFun = lineTypes.distinct, colorFun = colors.distinct,
  goal.markers = c(0.2, 0.4, 0.6, 0.8), time.markers = NULL,
  legend = NULL, legend.pos = "bottomleft", legend.cex = NA, ...)

Arguments

x

the data, maybe a list of [lists of matrices or a list of vectors/lists], where each element has at least the goal.dim and time.dim dimension.

goal.dim

the dimension where where the goal values can be found

time.dim

the dimension where the time values can be found

time.type

the type function the time dimension, should be as.integer or as.numeric

goal.type

the type function the goal dimension, should be as.integer or as.numeric

goal.min

the minimum goal value or NA to pick the minimum time value

goal.max

the maximum goal value or NA to pick the minimum time value

time.max

the maximum time value to be used, or NA to pick the maximum time value of any run

extract.run

a function which can be used to extract the single runs from the run sets, e.g., identity

extract.runs

a function which can be used to extract the run sets from x, e.g., identity

comparator

the comparator, usually `<=` or `>=`

lineTypeFun

the line type function, a function returning the line types to use for a provided number of inputs

colorFun

the colors function, a function returning the color list to use for a provided number of inputs

goal.markers

markers for the goal values

time.markers

markers for the time values

legend

the legend names

legend.pos

the legend position (optional, default: bottomleft)

legend.cex

the character sizing for the legend, optional, default NA

...

Arguments passed on to graphics::plot

x

the coordinates of points in the plot. Alternatively, a single plotting structure, function or any R object with a plot method can be provided.

y

the y coordinates of points in the plot, optional if x is an appropriate structure.

Value

a list(x=c(goal.min, goal.max), y=c(time.min, time.max)) of the minimum and maximum time and goal values encountered

Examples

 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
library("plotteR");

set.seed(10000L);

# create a single run
make.run <- function(q.best, time.worst, ...) {
  repeat {
    x <- sort(unique(as.integer(c(1L, time.worst, runif(n=19L, min=1L, max=time.worst)))));
    if(length(x) == 21L) { break; }
  }

  range <- 1 - q.best;
  repeat {
    l <- unique((exp(runif(n=20L, min=1L, max=5L))-exp(1L))/exp(5L));
    if(length(l) != 20L) { next; }
    if(any((l<=0) | (l >= 1))) { next; }
    y <- sort(unique(c(q.best, q.best + (range*l))), decreasing = TRUE);
    if(length(y) == 21L) { break; }
  }
  return(matrix(c(x, y), ncol=2L))
}

# make n runs
make.runs <- function(n, q.best, time.worst) {
  return(lapply(X=seq_len(n), FUN=make.run, q.best=q.best, time.worst=time.worst));
}

# plot five example ERTs
plot.func.ert(x = list(make.runs(20, 0.0, 1e6),
                       make.runs(20, 0.5, 1e6),
                       make.runs(20, 0.0, 1e4),
                       make.runs(20, 0.5, 1e4),
                       make.runs(20, 0.1, 1e5)),
              legend=c("slow+good", "slow+bad", "fast+good", "fast+bad", "ok+ok"),
              log="y",
              time.max=1e6,
              goal.min=0,
              goal.max=1,
              goal.markers = c(0.1, 0.5),
              time.markers = c(1e6, 1e4, 1e5));

thomasWeise/plotteR documentation built on May 29, 2019, 5:41 a.m.