Find extreme points of a nondominated set of points
Arguments
- pts
A set of non-dominated points. It is assumed that
ncol(pts)equals the number of objectives ($p$).- direction
Ray direction. If i'th entry is positive, consider the i'th column of the
ptsplus a value greater than on equal zero (minimize objective $i$). If negative, consider the i'th column of theptsminus a value greater than on equal zero (maximize objective $i$).
Value
The classification is extreme (se), supported non-extreme (sne) and unsupported us
nondominated points. Return the ND set with classification columns se (true/false), sne
(true/false), us (true/false) and cls (se, sne or us).
Note
It is assumed that pts are nondominated. This algorithm is faster than classifyNDSet(),
since only check for extreme points.
Examples
# \donttest{
pts <- matrix(c(0,0,1, 0,1,0, 1,0,0, 0.5,0.2,0.5, 0.25,0.5,0.25), ncol = 3, byrow = TRUE)
ini3D(argsPlot3d = list(xlim = c(min(pts[,1])-2,max(pts[,1])+2),
ylim = c(min(pts[,2])-2,max(pts[,2])+2),
zlim = c(min(pts[,3])-2,max(pts[,3])+2)))
plotHull3D(pts, addRays = TRUE, argsPolygon3d = list(alpha = 0.5), useRGLBBox = TRUE)
#> Warning: edge not found:1 2
#> Warning: edge not found:1 2
pts <- classifyNDSetExtreme(pts[,1:3])
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red")) # extreme
plotPoints3D(pts[is.na(pts$cls),1:3], argsPlot3d = list(col = "yellow")) # unclassified
finalize3D()
3D plot
pts
#> z1 z2 z3 se sne us cls
#> 1 0.00 0.0 1.00 TRUE FALSE FALSE se
#> 2 0.00 1.0 0.00 TRUE FALSE FALSE se
#> 3 1.00 0.0 0.00 TRUE FALSE FALSE se
#> 4 0.50 0.2 0.50 FALSE NA NA <NA>
#> 5 0.25 0.5 0.25 FALSE NA NA <NA>
pts <- matrix(c(0,0,1, 0,1,0, 1,0,0, 0.2,0.1,0.1, 0.1,0.45,0.45), ncol = 3, byrow = TRUE)
di <- -1 # maximize
ini3D(argsPlot3d = list(xlim = c(min(pts[,1])-1,max(pts[,1])+1),
ylim = c(min(pts[,2])-1,max(pts[,2])+1),
zlim = c(min(pts[,3])-1,max(pts[,3])+1)))
plotHull3D(pts, addRays = TRUE, argsPolygon3d = list(alpha = 0.5), direction = di,
addText = "coord")
#> Warning: edge not found:1 2
#> Warning: edge not found:1 2
pts <- classifyNDSetExtreme(pts[,1:3], direction = di)
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[is.na(pts$cls),1:3], argsPlot3d = list(col = "yellow")) # unclassified
finalize3D()
3D plot
pts
#> z1 z2 z3 se sne us cls
#> 1 0.0 0.00 1.00 TRUE FALSE FALSE se
#> 2 0.0 1.00 0.00 TRUE FALSE FALSE se
#> 3 1.0 0.00 0.00 TRUE FALSE FALSE se
#> 4 0.2 0.10 0.10 FALSE NA NA <NA>
#> 5 0.1 0.45 0.45 FALSE NA NA <NA>
pts <- matrix(c(0,0,1, 0,0,1, 0,1,0, 0.5,0.2,0.5, 1,0,0, 0.5,0.2,0.5, 0.25,0.5,0.25), ncol = 3,
byrow = TRUE)
classifyNDSetExtreme(pts)
#> z1 z2 z3 se sne us cls
#> 1 0.00 0.0 1.00 TRUE FALSE FALSE se
#> 2 0.00 1.0 0.00 TRUE FALSE FALSE se
#> 3 0.50 0.2 0.50 FALSE NA NA <NA>
#> 4 1.00 0.0 0.00 TRUE FALSE FALSE se
#> 5 0.25 0.5 0.25 FALSE NA NA <NA>
#> 6 6.00 0.0 1.00 FALSE NA NA <NA>
#> 7 6.00 1.0 0.00 FALSE NA NA <NA>
pts <- genNDSet(3,15)[,1:3]
ini3D(argsPlot3d = list(xlim = c(0,max(pts$z1)+2),
ylim = c(0,max(pts$z2)+2),
zlim = c(0,max(pts$z3)+2)))
plotHull3D(pts[, 1:3], addRays = TRUE, argsPolygon3d = list(alpha = 0.5))
#> Warning: edge not found:1 2
#> Warning: edge not found:1 2
pts <- classifyNDSetExtreme(pts[,1:3])
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[is.na(pts$cls),1:3], argsPlot3d = list(col = "yellow")) # unclassified
finalize3D()
3D plot
pts
#> z1 z2 z3 se sne us cls
#> 1 19 15 36 TRUE FALSE FALSE se
#> 2 13 21 37 TRUE FALSE FALSE se
#> 3 24 75 17 FALSE NA NA <NA>
#> 4 29 57 7 TRUE FALSE FALSE se
#> 5 43 2 47 TRUE FALSE FALSE se
#> 6 46 52 1 TRUE FALSE FALSE se
#> 7 20 13 40 TRUE FALSE FALSE se
#> 8 62 8 28 TRUE FALSE FALSE se
#> 9 6 31 61 TRUE FALSE FALSE se
#> 10 14 17 45 TRUE FALSE FALSE se
#> 11 4 69 51 TRUE FALSE FALSE se
#> 12 14 58 18 TRUE FALSE FALSE se
#> 13 65 47 3 FALSE NA NA <NA>
#> 14 68 24 12 TRUE FALSE FALSE se
#> 15 5 48 32 TRUE FALSE FALSE se
pts <- genNDSet(3, 15, keepDom = FALSE, argsSphere = list(below = FALSE, factor = 10))[,1:3]
ini3D(argsPlot3d = list(xlim = c(0,max(pts$z1)+2),
ylim = c(0,max(pts$z2)+2),
zlim = c(0,max(pts$z3)+2)))
plotHull3D(pts[, 1:3], addRays = TRUE, argsPolygon3d = list(alpha = 0.5))
#> Warning: edge not found:1 2
#> Warning: edge not found:1 2
pts <- classifyNDSetExtreme(pts[,1:3])
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[is.na(pts$cls),1:3], argsPlot3d = list(col = "yellow")) # unclassified
finalize3D()
3D plot
pts
#> z1 z2 z3 se sne us cls
#> 1 14 65 80 TRUE FALSE FALSE se
#> 2 19 55 89 FALSE NA NA <NA>
#> 3 20 77 79 FALSE NA NA <NA>
#> 4 95 28 51 FALSE NA NA <NA>
#> 5 79 67 13 TRUE FALSE FALSE se
#> 6 55 86 16 FALSE NA NA <NA>
#> 7 87 54 18 TRUE FALSE FALSE se
#> 8 91 21 53 TRUE FALSE FALSE se
#> 9 37 34 95 TRUE FALSE FALSE se
#> 10 48 90 21 TRUE FALSE FALSE se
#> 11 60 80 12 TRUE FALSE FALSE se
#> 12 23 45 91 TRUE FALSE FALSE se
#> 13 23 91 47 TRUE FALSE FALSE se
#> 14 29 87 75 FALSE NA NA <NA>
#> 15 48 26 93 TRUE FALSE FALSE se
# }