Skip to content

Commit

Permalink
Update vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
relund committed Feb 6, 2024
1 parent 508e4c4 commit 00f6f74
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
38 changes: 38 additions & 0 deletions vignettes/mo_costs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,44 @@ finalize3D()
rglwidget()
```

**Between planes**

The coefficient are generated between two planes in the range $[a,b]$.

```{r, eval=TRUE}
range <- matrix(c(1,100, 1, 100, 1, 100), ncol = 2, byrow = TRUE )
center <- rowMeans(range)
planeU <- c(rep(1, 3), -1.2*sum(rowMeans(range)))
planeL <- c(rep(1, 3), -0.6*sum(rowMeans(range)))
pts <- genSample(3, 1000, range = range, planes = TRUE,
argsPlanes = list(center = center, planeU = planeU, planeL = planeL))
ini3D(argsPlot3d = list(box = TRUE, axes = TRUE))
plotPoints3D(pts)
rgl::planes3d(planeL[1], planeL[2], planeL[3], planeL[4], alpha = 0.5)
rgl::planes3d(planeU[1], planeU[2], planeU[3], planeU[4], alpha = 0.5)
finalize3D()
rglwidget(reuse = F)
```


**Sphere**

The coefficients are generated on the lower part of a sphere (see next picture). Note that the sphere is adjusted such that the coefficients are in the range $[a,b]$, i.e. the sphere is not necessarily included in $[a,b]^p$.

```{r, eval=T}
cent <- c(1000,1000,1000)
r <- 750
planeC <- c(cent-r/3)
planeC <- c(planeC, -sum(planeC^2))
pts <- genSample(3, 500,
argsSphere = list(center = cent, radius = r, below = NULL, plane = planeC, factor = 6))
ini3D()
plotPoints3D(pts)
spheres3d(cent, radius=r, color = "grey100", alpha=0.1)
finalize3D()
rglwidget(reuse = F)
```

**Sphere down**

The coefficients are generated on the lower part of a sphere (see next picture). Note that the sphere is adjusted such that the coefficients are in the range $[a,b]$, i.e. the sphere is not necessarily included in $[a,b]^p$.
Expand Down
16 changes: 8 additions & 8 deletions vignettes/mo_shapes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,32 @@ We define the sets $\mathbb{R}_{>} = \{ z\in \mathbb{R} \mid z > 0\}$, $\mathbb{
```{r}
rgl::mfrow3d(nr = 1, nc = 3, sharedMouse = TRUE)
## Set R^3_>=
ini3D(argsPlot3d = list(xlim = c(-5, 100), ylim = c(-5, 100), zlim = c(-5, 100)))
ini3D(clear = FALSE, new = FALSE, argsPlot3d = list(xlim = c(-5, 100), ylim = c(-5, 100), zlim = c(-5, 100)))
plotCones3D(c(0,0,0), drawPoint = F, argsPolygon3d = list(alpha=0.8))
title3d(main = "R_>=")
finalize3D()
next3d()
## Set R^3_>-
ini3D(clear = FALSE, argsPlot3d = list(xlim = c(-5, 100), ylim = c(-5, 100), zlim = c(-5, 100)))
ini3D(clear = FALSE, new = FALSE, argsPlot3d = list(xlim = c(-5, 100), ylim = c(-5, 100), zlim = c(-5, 100)))
plotCones3D(c(0,0,0), drawPoint = F, argsPolygon3d = list(alpha=0.8))
rgl::spheres3d(0,0,0, radius = 2, alpha = 0.8, col="gray80")
title3d(main = "R_>-")
finalize3D()
next3d()
## Set R^3_>
ini3D(clear = FALSE, argsPlot3d = list(xlim = c(-5, 100), ylim = c(-5, 100), zlim = c(-5, 100)))
ini3D(clear = FALSE, new = FALSE, argsPlot3d = list(xlim = c(-5, 100), ylim = c(-5, 100), zlim = c(-5, 100)))
plotCones3D(c(0,0,0), drawPoint = F, argsPolygon3d = list(alpha=0.3, color = "red"))
title3d(main = "R_>")
finalize3D()
rglwidget()
close3d()
# close3d()
```

The non-dominated set (red points are non-dominated and black dominated):

```{r nd points}
library(gMOIP)
pts <- genNDSet(3, 100, keep = TRUE, dubND = FALSE)
pts <- genNDSet(3, 20, keep = TRUE, dubND = FALSE)
ini3D()
plotPoints3D(pts[!pts$nd,1:3])
plotPoints3D(pts[pts$nd,1:3], argsPlot3d = list(col = "red"))
Expand Down Expand Up @@ -104,10 +104,10 @@ Note the area between the hull and the cones is the search area where further no
Another example with more unsupported points:

```{r}
pts1 <- genNDSet(3, 100, keep = T, argsSphere = list(below = F))
pts1 <- genNDSet(3, 10, keep = T, argsSphere = list(below = F))
lim1 <- as.data.frame(apply(pts1, 2, function(x) c(min(x)-5, max(x)+5)))
ini3D(argsPlot3d = list(xlim = lim1$z1, ylim = lim1$z2, zlim = lim1$z3))
plotPoints3D(pts1[!pts1$nd, 1:3])
# plotPoints3D(pts1[!pts1$nd, 1:3])
plotHull3D(
pts1[pts1$nd, 1:3],
addRays = T,
Expand All @@ -125,7 +125,7 @@ rglwidget()
We may also plot reverse dominance cones:

```{r}
pts2 <- genNDSet(3, 50, range = c(1,20), dubND = FALSE)
pts2 <- genNDSet(3, 10, range = c(1,20), dubND = FALSE)
lim2 <- as.data.frame(apply(pts2, 2, function(x) c(min(x)-5, max(x)+5)))
ini3D(argsPlot3d = list(xlim = lim2$z1, ylim = lim2$z2, zlim = lim2$z3))
plotCones3D(
Expand Down
6 changes: 3 additions & 3 deletions vignettes/tri-objective.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The criterion space can be plotted for tri-objective models. An example with man
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 <- genNDSet(3, 20, argsSphere = list(below = FALSE), dubND = FALSE)
pts <- classifyNDSet(pts[,1:3])
head(pts)
ini3D(argsPlot3d = list(xlim = c(min(pts[,1])-2,max(pts[,1])+2),
Expand All @@ -66,7 +66,7 @@ Example with many supported:

```{r, webgl=TRUE, cache=FALSE}
loadView(v = view)
pts <- genNDSet(3, 50, argsSphere = list(below = TRUE), dubND = FALSE)
pts <- genNDSet(3, 10, 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),
Expand Down Expand Up @@ -102,7 +102,7 @@ rglwidget(reuse = F)


```{r}
pts <- genNDSet(3,50, dubND = FALSE)[,1:3]
pts <- genNDSet(3,20, dubND = FALSE)[,1:3]
open3d()
ini3D(argsPlot3d = list(xlim = c(0,max(pts$z1)+2),
ylim = c(0,max(pts$z2)+2),
Expand Down

0 comments on commit 00f6f74

Please sign in to comment.