File: eafplot.Rd

package info (click to toggle)
r-cran-eaf 2.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,028 kB
  • sloc: ansic: 7,281; perl: 848; makefile: 73; sh: 43; python: 27
file content (192 lines) | stat: -rw-r--r-- 6,966 bytes parent folder | download | duplicates (2)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/eafplot.R
\name{eafplot}
\alias{eafplot}
\alias{eafplot.default}
\alias{eafplot.formula}
\alias{eafplot.list}
\title{Plot the Empirical Attainment Function for two objectives}
\usage{
eafplot(x, ...)

\method{eafplot}{default}(
  x,
  sets = NULL,
  groups = NULL,
  percentiles = c(0, 50, 100),
  attsurfs = NULL,
  xlab = NULL,
  ylab = NULL,
  xlim = NULL,
  ylim = NULL,
  log = "",
  type = "point",
  col = NULL,
  lty = c("dashed", "solid", "solid", "solid", "dashed"),
  lwd = 1.75,
  pch = NA,
  cex.pch = par("cex"),
  las = par("las"),
  legend.pos = "topright",
  legend.txt = NULL,
  extra.points = NULL,
  extra.legend = NULL,
  extra.pch = 4:25,
  extra.lwd = 0.5,
  extra.lty = NA,
  extra.col = "black",
  maximise = c(FALSE, FALSE),
  xaxis.side = "below",
  yaxis.side = "left",
  axes = TRUE,
  sci.notation = FALSE,
  ...
)

\method{eafplot}{formula}(formula, data, groups = NULL, subset = NULL, ...)

\method{eafplot}{list}(x, ...)
}
\arguments{
\item{x}{Either a matrix of data values, or a data frame, or a list of
data frames of exactly three columns.}

\item{...}{Other graphical parameters to \code{\link[=plot.default]{plot.default()}}.}

\item{sets}{(\link{numeric})\cr Vector indicating which set each point belongs to.}

\item{groups}{This may be used to plot profiles of different algorithms on the same plot.}

\item{percentiles}{(\code{numeric()}) Vector indicating which percentile should be plot. The
default is to plot only the median attainment curve.}

\item{attsurfs}{TODO}

\item{xlab, ylab, xlim, ylim, log, col, lty, lwd, pch, cex.pch, las}{Graphical
parameters, see \code{\link[=plot.default]{plot.default()}}.}

\item{type}{(\code{character(1)})\cr string giving the type of plot desired.  The following values
are possible, \samp{points} and \samp{area}.}

\item{legend.pos}{the position of the legend, see \code{\link[=legend]{legend()}}.  A value of \code{"none"} hides the legend.}

\item{legend.txt}{a character or expression vector to appear in the
legend. If \code{NULL}, appropriate labels will be generated.}

\item{extra.points}{A list of matrices or data.frames with
two-columns. Each element of the list defines a set of points, or
lines if one of the columns is \code{NA}.}

\item{extra.legend}{A character vector providing labels for the
groups of points.}

\item{extra.pch, extra.lwd, extra.lty, extra.col}{Control the graphical aspect
of the points. See \code{\link[=points]{points()}} and \code{\link[=lines]{lines()}}.}

\item{maximise}{(\code{logical()} | \code{logical(1)}) \cr Whether the objectives must be
maximised instead of minimised. Either a single logical value that applies
to all objectives or a vector of logical values, with one value per
objective.}

\item{xaxis.side}{On which side that x-axis is drawn. Valid values are
\code{"below"} and \code{"above"}. See \code{\link[=axis]{axis()}}.}

\item{yaxis.side}{On which side that y-axis is drawn. Valid values are \code{"left"}
and \code{"right"}. See \code{\link[=axis]{axis()}}.}

\item{axes}{A logical value indicating whether both axes should be drawn
on the plot.}

\item{sci.notation}{Generate prettier labels}

\item{formula}{A formula of the type: \code{time + cost ~ run | instance}
will draw \code{time} on the x-axis and \code{cost} on the y-axis. If \code{instance} is
present the plot is conditional to the instances.}

\item{data}{Dataframe containing the fields mentioned in the formula and in groups.}

\item{subset}{(\code{integer()} | \code{NULL})\cr A vector indicating which rows of the data should be used. If left to default \code{NULL} all data in the data frame are used.}
}
\value{
Return (invisibly) the attainment surfaces computed.
}
\description{
Computes and plots the Empirical Attainment Function, either as
attainment surfaces for certain percentiles or as points.
}
\details{
This function can be used to plot random sets of points like those obtained
by different runs of biobjective stochastic optimisation algorithms.  An EAF
curve represents the boundary separating points that are known to be
attainable (that is, dominated in Pareto sense) in at least a fraction
(quantile) of the runs from those that are not. The median EAF represents
the curve where the fraction of attainable points is 50\%.  In single
objective optimisation the function can be used to plot the profile of
solution quality over time of a collection of runs of a stochastic optimizer.
}
\section{Methods (by class)}{
\itemize{
\item \code{eafplot(default)}: Main function

\item \code{eafplot(formula)}: Formula interface

\item \code{eafplot(list)}: List interface for lists of data.frames or matrices

}}
\examples{
data(gcp2x2)
tabucol <- subset(gcp2x2, alg != "TSinN1")
tabucol$alg <- tabucol$alg[drop=TRUE]
eafplot(time + best ~ run, data = tabucol, subset = tabucol$inst=="DSJC500.5")

\donttest{# These take time
eafplot(time + best ~ run | inst, groups=alg, data=gcp2x2)
eafplot(time + best ~ run | inst, groups=alg, data=gcp2x2,
	percentiles=c(0,50,100), cex.axis = 0.8, lty = c(2,1,2), lwd = c(2,2,2),
     col = c("black","blue","grey50"))

extdata_path <- system.file(package = "eaf", "extdata")
A1 <- read_datasets(file.path(extdata_path, "ALG_1_dat.xz"))
A2 <- read_datasets(file.path(extdata_path, "ALG_2_dat.xz"))
eafplot(A1, percentiles = 50, sci.notation = TRUE, cex.axis=0.6)
# The attainment surfaces are returned invisibly.
attsurfs <- eafplot(list(A1 = A1, A2 = A2), percentiles = 50)
str(attsurfs)

## Save as a PDF file.
# dev.copy2pdf(file = "eaf.pdf", onefile = TRUE, width = 5, height = 4)
}

## Using extra.points
\donttest{
data(HybridGA)
data(SPEA2relativeVanzyl)
eafplot(SPEA2relativeVanzyl, percentiles = c(25, 50, 75), 
        xlab = expression(C[E]), ylab = "Total switches", xlim = c(320, 400),
        extra.points = HybridGA$vanzyl, extra.legend = "Hybrid GA")

data(SPEA2relativeRichmond)
eafplot (SPEA2relativeRichmond, percentiles = c(25, 50, 75),
         xlab = expression(C[E]), ylab = "Total switches",
         xlim = c(90, 140), ylim = c(0, 25),
         extra.points = HybridGA$richmond, extra.lty = "dashed",
         extra.legend = "Hybrid GA")

eafplot (SPEA2relativeRichmond, percentiles = c(25, 50, 75),
         xlab = expression(C[E]), ylab = "Total switches",
         xlim = c(90, 140), ylim = c(0, 25), type = "area",
         extra.points = HybridGA$richmond, extra.lty = "dashed",
         extra.legend = "Hybrid GA", legend.pos = "bottomright")

data(SPEA2minstoptimeRichmond)
SPEA2minstoptimeRichmond[,2] <- SPEA2minstoptimeRichmond[,2] / 60
eafplot (SPEA2minstoptimeRichmond, xlab = expression(C[E]),
         ylab = "Minimum idle time (minutes)", maximise = c(FALSE, TRUE),
         las = 1, log = "y", main = "SPEA2 (Richmond)",
         legend.pos = "bottomright")
}
}
\seealso{
\code{\link[=eafdiffplot]{eafdiffplot()}} \code{\link[=pdf_crop]{pdf_crop()}}
}
\concept{visualisation}