Plotting tri-objective models

Lars Relund Nielsen

2021-01-19

With gMOIP you can make plots of the criterion space for tri-objective models (linear programming (LP), integer linear programming (ILP), or mixed integer linear programming (MILP)). This vignette gives examples on how to make plots of the criterion space.

First we load the package:

library(gMOIP)

The criterion space can be plotted for tri-objective models. An example with many unsupported:

view <- matrix( c(0.333316594362259, 0.938472270965576, -0.0903875231742859, 0, 0.83994072675705, -0.339126199483871, -0.423665106296539, 0, -0.428250730037689, 0.0652943551540375, -0.901297807693481, 0, 0, 0, 0, 1), nc = 4)
loadView(v = view)
set.seed(1234)
pts <- genNDSet(3, 100, argsSphere = list(below = FALSE), dubND = FALSE)
pts <- classifyNDSet(pts[,1:3])
head(pts)
#>   z1 z2 z3    se   sne    us cls
#> 1 14 59 83  TRUE FALSE FALSE  se
#> 2 15 84 59  TRUE FALSE FALSE  se
#> 3 17 87 57 FALSE FALSE  TRUE  us
#> 4 18 76 78 FALSE FALSE  TRUE  us
#> 5 19 53 89 FALSE FALSE  TRUE  us
#> 6 20 80 77 FALSE FALSE  TRUE  us
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)))
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[!pts$sne,1:3], argsPlot3d = list(col = "black"))
plotPoints3D(pts[!pts$us,1:3], argsPlot3d = list(col = "blue"))
plotCones3D(pts[,1:3], rectangle = TRUE, argsPolygon3d = list(alpha = 1, color = "cornflowerblue"))
plotHull3D(pts[,1:3], addRays = TRUE, argsPolygon3d = list(alpha = 0.25, color = "red"), useRGLBBox = TRUE)
finalize3D(argsAxes3d = list(edges = "bbox"))

Example with many supported:

loadView(v = view)
pts <- genNDSet(3, 50, argsSphere = list(below = TRUE), dubND = FALSE)
pts <- classifyNDSet(pts[,1:3])
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)))
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[!pts$sne,1:3], argsPlot3d = list(col = "black"))
plotPoints3D(pts[!pts$us,1:3], argsPlot3d = list(col = "blue"))
plotCones3D(pts[,1:3], rectangle = TRUE, argsPolygon3d = list(alpha = 1, color = "cornflowerblue"))
plotHull3D(pts[,1:3], addRays = TRUE, argsPolygon3d = list(alpha = 0.25, color = "red"), useRGLBBox = TRUE)
finalize3D(argsAxes3d = list(edges = "bbox"))

Classifying

Non-dominated points can be classified using classifyNDSet:

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)
open3d()
#> null 
#>   33
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)
pts <- classifyNDSet(pts[,1:3])
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[!pts$sne,1:3], argsPlot3d = list(col = "black"))
plotPoints3D(pts[!pts$us,1:3], argsPlot3d = list(col = "blue"))
plotCones3D(pts[,1:3], rectangle = TRUE, argsPolygon3d = list(alpha = 1))
finalize3D()
rglwidget(reuse = F)
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 FALSE  TRUE  us
#> 5 0.25 0.5 0.25 FALSE  TRUE FALSE sne

pts <- genNDSet(3,50, dubND = FALSE)[,1:3]
open3d()
#> null 
#>   35
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, addRays = TRUE, argsPolygon3d = list(alpha = 0.5))
pts <- classifyNDSet(pts[,1:3])
plotPoints3D(pts[pts$se,1:3], argsPlot3d = list(col = "red"))
plotPoints3D(pts[!pts$sne,1:3], argsPlot3d = list(col = "black"))
plotPoints3D(pts[!pts$us,1:3], argsPlot3d = list(col = "blue"))
finalize3D()
rglwidget(reuse = F)
pts
#>    z1 z2 z3    se   sne    us cls
#> 1   2 59 51  TRUE FALSE FALSE  se
#> 2   3 44 38  TRUE FALSE FALSE  se
#> 3   6 59 29  TRUE FALSE FALSE  se
#> 4   7 37 71 FALSE FALSE  TRUE  us
#> 5   8 33 32  TRUE FALSE FALSE  se
#> 6   9 29 34  TRUE FALSE FALSE  se
#> 7  11 68 26 FALSE FALSE  TRUE  us
#> 8  13 26 30  TRUE FALSE FALSE  se
#> 9  15 22 30  TRUE FALSE FALSE  se
#> 10 15 24 29  TRUE FALSE FALSE  se
#> 11 17 15 42  TRUE FALSE FALSE  se
#> 12 25 11 66 FALSE FALSE  TRUE  us
#> 13 30 39  7  TRUE FALSE FALSE  se
#> 14 31 39  6  TRUE FALSE FALSE  se
#> 15 33 18 17  TRUE FALSE FALSE  se
#> 16 38  5 64 FALSE FALSE  TRUE  us
#> 17 42  2 44  TRUE FALSE FALSE  se
#> 18 48 11 20  TRUE FALSE FALSE  se
#> 19 49  1 54  TRUE FALSE FALSE  se
#> 20 52 38  3  TRUE FALSE FALSE  se
#> 21 54 21 11  TRUE FALSE FALSE  se
#> 22 60 45  2  TRUE FALSE FALSE  se
#> 23 61  4 37  TRUE FALSE FALSE  se
#> 24 63 27  9 FALSE FALSE  TRUE  us

The classification is done using the qhull algorithm that find the convex hull of the points including the rays. If a vertex then if must be supported extreme. Next we use the inHull algorithm to find out if the remaining are on the border or not (supported non-extreme and unsupported).