/
plot_MBOResult.R
69 lines (58 loc) · 2.06 KB
/
plot_MBOResult.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
#' @title MBO Result Plotting
#'
#' @description
#' Plots any MBO result objects. Plots for X-Space, Y-Space and any column in
#' the optimization path are available. This function uses
#' \code{\link[ParamHelpers]{plotOptPath}} from package \code{ParamHelpers}.
#'
#' @name plotMBOResult
#' @rdname plotMBOResult
#'
#'
#' @param x [\code{MBOResult}]\cr
#' \code{MBOSingleObjResult} or \code{MBOMultiObjResult} object.
#' @param iters [\code{integer}]\cr
#' Iterations to be plotted, 0 indicates the initial design. Default is all iterations.
#' @param pause [\code{logical(1)}]\cr
#' Should the process be paused after each iteration?
#' Default is \code{interactive()}.
#' @param ...
#' Additional parameters for the \code{\link[ParamHelpers]{plotOptPath}}
#' function in package \code{ParamHelpers}.
#'
NULL
#' @rdname plotMBOResult
#' @export
plot.MBOSingleObjResult = function(x, iters = NULL, pause = interactive(), ...) {
# extract and set params
opt.path = x$opt.path
control = x$control
y.names = opt.path$y.names
infill.crit.id = getMBOInfillCritId(control$infill.crit)
if (is.null(iters))
iters = max(getOptPathDOB(opt.path))
args = list(...)
args = insert(args, list(op = opt.path, iters = iters, pause = pause))
args = insert(list(y.over.time = list(y.names, infill.crit.id), title = "MBO Result"), args)
do.call(plotOptPath, args)
}
#' @rdname plotMBOResult
#' @export
plot.MBOMultiObjResult = function(x, iters = NULL, pause = interactive(), ...) {
# extract and set params
opt.path = x$opt.path
control = x$control
y.names = opt.path$y.names
infill.crit.id = getMBOInfillCritId(control$infill.crit)
if (control$multiobj.method == "mspot") {
infill.crit = paste(infill.crit.id, opt.path$y.names, sep = ".")
} else {
infill.crit = infill.crit.id
}
if (is.null(iters))
iters = max(getOptPathDOB(opt.path))
args = list(...)
args = insert(args, list(op = opt.path, iters = iters, pause = pause))
args = insert(list(y.over.time = list(y.names, infill.crit), title = "MBO Result"), args)
do.call(plotOptPath, args)
}