Skip to content

Commit

Permalink
version 1.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Relund Nielsen authored and cran-robot committed Jan 26, 2023
1 parent c0516ea commit 9135167
Show file tree
Hide file tree
Showing 54 changed files with 19,522 additions and 815 deletions.
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: gMOIP
Type: Package
Title: Tools for 2D and 3D Plots of Single and Multi-Objective
Linear/Integer Programming Models
Version: 1.4.7
Version: 1.4.8
Authors@R: person("Lars", "Relund Nielsen", email = "lars@relund.dk", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-4802-3071"))
URL: https://relund.github.io/gMOIP/, https://github.com/relund/gMOIP/
Expand All @@ -16,20 +16,19 @@ Description: Make 2D and 3D plots of linear programming (LP),
License: GPL (>= 3.3.2)
Language: en-US
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
Depends: R (>= 3.5.0)
Imports: ggrepel, geometry, ggplot2, rgl, MASS, Matrix, grDevices,
stats, Rfast, plyr, tidyselect, tidyr, tibble, purrr, dplyr,
rlang, png, sp
Suggests: tikzDevice, grid, gridExtra, knitr, rmarkdown, roxygen2,
ggsci, tidyverse, magrittr, scales, pdftools, testthat (>=
2.1.0), webshot2
Additional_repositories: https://dmurdoch.github.io/drat
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2021-08-23 11:19:02 UTC; au15463
Packaged: 2023-01-26 12:13:47 UTC; au15463
Author: Lars Relund Nielsen [aut, cre]
(<https://orcid.org/0000-0002-4802-3071>)
Maintainer: Lars Relund Nielsen <lars@relund.dk>
Repository: CRAN
Date/Publication: 2021-08-23 14:20:02 UTC
Date/Publication: 2023-01-26 16:30:02 UTC
105 changes: 53 additions & 52 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,88 +1,89 @@
cd7eef1adcb7e9b5b1edd96986e14c3f *DESCRIPTION
21a044616e05b4dcbb2ac4f9ebb93278 *DESCRIPTION
1447549699eeb9e263f215b5c6c1c07e *NAMESPACE
2ed1052b0fdc3cdadd9a2e3c594a410b *NEWS.md
8c58617b4046234a0da56c1c7e91dee6 *R/functions.R
a330f347c8c9662df1d4d37b8c602587 *R/hull.R
3136f24c2ab45abdd7da286de1a09830 *R/ndset.R
6c9b7cbacf08aa402cda71c11897dec6 *R/package_doc.R
36ba800770e48966ebe4b94218f6ee44 *R/plot.R
b6e408bbd533b0c4fc7e9994653eba94 *build/vignette.rds
61346f252f19f01d31c9435e663c02e3 *NEWS.md
214b8d2a13cb102ab0a3c937c469ed44 *R/functions.R
d6acbdaf413c8c17db61ab8dd9715c00 *R/hull.R
e5fad87b39964326a4b2244331780df3 *R/ndset.R
b5dee89112c2479b7caf3af9d525c2bf *R/package_doc.R
000217eb42ffe83b9dae3c46eed19d1a *R/plot.R
8c3621a50fedc4a3f0910eb25b3c6e0a *build/vignette.rds
01836569685ec34173b8396e8135303d *inst/WORDLIST
50a5843cadc9b3431e2ee1b25df0a30c *inst/doc/bi-objective_2x.R
1e29f80c945bac41f3a89d0aabf4129c *inst/doc/bi-objective_2x.Rmd
a49d554c6846a69159c59c1075d9f75f *inst/doc/bi-objective_2x.html
5346dc3a7662bdea86b7beda6bfe64e2 *inst/doc/bi-objective_2x.html
13d0b61a12126c3420a47c2353677e05 *inst/doc/bi-objective_3x_ex1.R
55050a779be09b23e15db7cd38f683d1 *inst/doc/bi-objective_3x_ex1.Rmd
b83c5ac624cf444297bb5e7dcf565e31 *inst/doc/bi-objective_3x_ex1.html
9afce647cf8d8ae97468c45c7d0efa2b *inst/doc/bi-objective_3x_ex1.html
83d25a4b749a212c331cbd31dcceac9b *inst/doc/intro.R
1da2459f0797116847dfce0784b002b6 *inst/doc/intro.Rmd
ddb96383c02eb13133a4427bcadc8810 *inst/doc/intro.html
fbe645db0f87db4f795dd2da413f1139 *inst/doc/intro.html
ca8e35f10b19be8c33f0536e8dea70fa *inst/doc/polytope_2d.R
fe0d7c446096155964ae7f335f7706fb *inst/doc/polytope_2d.Rmd
036248c30e867fd414d0aebb8d95475d *inst/doc/polytope_2d.html
4ff4f8ba139bfd2ee812df6915cbcd8c *inst/doc/polytope_2d.html
2e3735319048065110e6de0b52d5accc *inst/doc/polytope_3d_ex1.R
8230331a3182286fc0fb0e401d132abf *inst/doc/polytope_3d_ex1.Rmd
9100c202474ec3086004dca3e598cccd *inst/doc/polytope_3d_ex1.html
0f1fb3f5058b15b72ee3aa9ec4abbea5 *inst/doc/polytope_3d_ex1.html
5721f4f76696bc83cbd62cb5d6cea682 *inst/doc/tri-objective.R
f59d47b4da705eb82b404ac9d4b9305f *inst/doc/tri-objective.Rmd
7c41f1d3ca93b68ef2ed51c7d99dc6f7 *inst/doc/tri-objective.html
a9008920632419b8d1fa76c9278f218e *inst/doc/tri-objective.Rmd
a4736eaec010597e0ae3c595fdd1f747 *inst/doc/tri-objective.html
1a9b9c4e6e500951767ce45a73250c2c *inst/examples/3d_interactive.Rmd
727f5ee1109a0f04e23f7005eda0f977 *inst/examples/3d_interactive.html
88786ea83c18d6dbd3eca916d80daa24 *inst/examples/ex_criterion.R
67fc05e98bcbc9e0f44535f2e2370cc2 *inst/examples/ex_polytope.R
71426d2b674a984420d15b2556127a84 *man/addNDSet.Rd
b4d3bb7cdfdd19873fe7e59f299d3b7e *man/addNDSet2D.Rd
0b4b73340a9c155560c8049560d681e8 *man/addRays.Rd
b05faa0065fa3590c08572d5f4b6aaaa *inst/examples/ex_polytope.R
6116aab6f4db3fe2071d04a05f6c418f *man/addNDSet.Rd
c65049610bfec323a900928ae81a7670 *man/addNDSet2D.Rd
ca9f8955cd9c849ab5536fb249c00937 *man/addRays.Rd
8b6dc0c479a94d0d808b902fda7c45dc *man/binaryPoints.Rd
c41ce92c0e637f57330fb7733b1c3158 *man/classifyNDSet.Rd
97cafd9c05a1e5db5eb7bb4a24b87c85 *man/convexHull.Rd
36c3f61cf5ce7015ac4448f1081697d5 *man/convexHull.Rd
f409748078df5a5c35d6169ee3c558f7 *man/cornerPoints.Rd
583c100a2abc5564dbc6fed00456ffe2 *man/cornerPointsCont.Rd
9e58385c39d46f9d4bda7f8e88ee1d3f *man/criterionPoints.Rd
7ce4f543e162aef3a4d738347dff894c *man/criterionPoints.Rd
a6b03349c279be46fedc60801b6a2ba9 *man/df2String.Rd
e7ef47c80e3712a90f8d6a1d82d21e49 *man/dimFace.Rd
84e7b820465fe04953e8e065edbcf069 *man/dot-checkPts.Rd
c8d7d39436990fbbee8664bbcf213c3d *man/dot-getRanges.Rd
9dc7128325b27cc4832f9e8d1f6d6836 *man/dot-getRanges.Rd
a436f43181a062df0f9c65a35d0a4e02 *man/dot-mToDirection.Rd
f20ed4a9df731dc4a34e14c4ae52d573 *man/dot-sizeM.Rd
133ef32ca6b296df716d54a07121f711 *man/figures/README-3d.gif
8afa850c355d339f12e205e766296b5e *man/figures/README-ilp-1.png
b1626f538fa85fe3337216e22510b194 *man/figures/README-lp-1.png
15e4bb1e56c4427a7b8fbdaf343d3558 *man/figures/README-milp-1.png
ecd9348a0ded3a017f9d79d255bd091f *man/finalize3D.Rd
7b0b690e63fef090a50c72e0116185cf *man/gMOIP-package.Rd
1ecae0937605178f1a9c8e96803829bb *man/gMOIPTheme.Rd
1b2744ab09e68a6d432d9b7385d8ed3e *man/dot-sizeM.Rd
5b9f1830704e0051dfcd31c22c16784b *man/figures/README-3d.gif
abcc85a8eacfa0101a013bff042732fb *man/figures/README-ilp-1.png
9b35a3b4f0b5eecbcb8cbc858daf342b *man/figures/README-lp-1.png
908026e34a13cd60b32f2ca4e96f9569 *man/figures/README-milp-1.png
e27eef1c5da09b0acc6e1852cb588bd4 *man/finalize3D.Rd
a34a321f1ac84bdbff346c7356d51679 *man/gMOIP-package.Rd
8c8ff0c7e182f0fa6108b6d40c0b4607 *man/gMOIPTheme.Rd
a7ba50886f076ddf3b2e7b8688b25e0b *man/genNDSet.Rd
5ff859821fe588e0b5bcd187f6a7aafb *man/genSample.Rd
652614ced939a313e1daeb1907a84304 *man/getTexture.Rd
04beea2a3c8d4145c0ded4d80bbdf604 *man/hullSegment.Rd
57c1a8b3fe17ccf49ff9794e910e4705 *man/inHull.Rd
b01833fdb4662a3712b856dcc431da66 *man/ini3D.Rd
fc52950811bc6bb3905d785c77123395 *man/getTexture.Rd
d43075cb1534099901aa161f43ec6ef0 *man/hullSegment.Rd
314754627ac8b16e19998d6da4a1abb0 *man/inHull.Rd
f2bff68feb2391772f2e39d2d8fbaf0c *man/ini3D.Rd
3cfb5f0ab19ec51a827bfd7440b7295e *man/integerPoints.Rd
9f19a2658ba6a27c4ff6f648406a7b46 *man/loadView.Rd
caf723f3753b87888a181a2c4d8049c0 *man/loadView.Rd
4a083fb5ff274a620a81906b4b4efe3e *man/mergeLists.Rd
2e48da92cb97400f4b3f30755dc94bf4 *man/plotCones2D.Rd
d1ba1a68a3c7e280523cbaf3a6a87793 *man/plotCones3D.Rd
c505de2802109410300e96280a923a56 *man/plotCriterion2D.Rd
d5081ee655fb65d070495f0aed751453 *man/plotHull2D.Rd
8e3f415bc87339c5ab4f632c90bfcda4 *man/plotHull3D.Rd
1c51172928f45846e57bc19836361037 *man/plotMTeX3D.Rd
462f59d96d1ff8a69d833be13c80bab3 *man/plotNDSet2D.Rd
64efd4c4da2d4f15b085e6494e95143b *man/plotPlane3D.Rd
d95b5258458869ccaeb7a62a457e1757 *man/plotPoints3D.Rd
a7c71dde8fa0192a2a7f4d72ff6fb2f7 *man/plotPolygon3D.Rd
050008f1970bcc7853b84f5db3cb8e27 *man/plotPolytope.Rd
ff99ac7118a10e951161275bba53030d *man/plotPolytope2D.Rd
7af51a5aa7eac4b556a60cb8ddf04e77 *man/plotPolytope3D.Rd
54e7430ab6fff47d6c886fce37d494bb *man/plotRectangle3D.Rd
05bba403f9ade4502f43893edda49b7f *man/plotTeX3D.Rd
df33874e326cb4fbee42eb0296890f39 *man/plotCones2D.Rd
86015003ffb1b31d19e8afc0e561d627 *man/plotCones3D.Rd
034d6143b759de49a2444ef44631a3c0 *man/plotCriterion2D.Rd
f447d1b3accee96264cd684782a5a2a6 *man/plotHull2D.Rd
7c38e9beccb90a1d2a64b216719a568d *man/plotHull3D.Rd
4302763ddbafdc7abb03bca0a1962484 *man/plotMTeX3D.Rd
89e0b0eb027c4dc706f8e0028b718f21 *man/plotNDSet2D.Rd
daf669dfcb5803d65adc4c3e3b74e085 *man/plotPlane3D.Rd
957bf4025d1dcfc377d53d8bfbd861e5 *man/plotPoints3D.Rd
0491fc312106aaa9b1a6ed2f1999a37e *man/plotPolygon3D.Rd
16c2706d92eef2fa6a990bfa0215ebe0 *man/plotPolytope.Rd
88c432b7f7172309106aa30293c50eec *man/plotPolytope2D.Rd
bb2d9bffe007a6661eeb6d8ea0f5fd44 *man/plotPolytope3D.Rd
873d87313825b7655e7e9b0935487691 *man/plotRectangle3D.Rd
9925b701f6d9bdabbbde5f4fd7b2e7c6 *man/plotTeX3D.Rd
556b23db0ecc258d0b4480d864778746 *man/plotTitleTeX3D.Rd
b5fec02450307961e886c8d2163b7622 *man/pngSize.Rd
d8ef93539cbf6ffc31b0440673efa670 *man/saveView.Rd
b1f6f8b5242d9e88ee02d0a8b8b2fa98 *man/slices.Rd
947c532d47dfa4265fa3390cf7435da7 *man/texToPng.Rd
9ccf99a79ca97d25b9c3fc508142979f *man/texToPng.Rd
1e29f80c945bac41f3a89d0aabf4129c *vignettes/bi-objective_2x.Rmd
55050a779be09b23e15db7cd38f683d1 *vignettes/bi-objective_3x_ex1.Rmd
1da2459f0797116847dfce0784b002b6 *vignettes/intro.Rmd
fe0d7c446096155964ae7f335f7706fb *vignettes/polytope_2d.Rmd
8230331a3182286fc0fb0e401d132abf *vignettes/polytope_3d_ex1.Rmd
f59d47b4da705eb82b404ac9d4b9305f *vignettes/tri-objective.Rmd
a9008920632419b8d1fa76c9278f218e *vignettes/tri-objective.Rmd
9 changes: 7 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# gMOIP 1.4.8

* Change `rgl.*` to `*3d` functions.
* Fixed bugs due to dependent package updates.

# gMOIP 1.4.7

*Fixed errors about pandoc missing and added webshot2.
* Fixed errors about pandoc missing and added `webshot2`.

# gMOIP 1.4.6

Expand Down Expand Up @@ -30,7 +35,7 @@
# gMOIP 1.3.0

* Added support for 3D plots using RGL.
* Added highlevel functions for plotting.
* Added high level functions for plotting.
* Can plot the criterion space for bi-objective models.

# gMOIP 1.2.0
Expand Down
2 changes: 1 addition & 1 deletion R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ cornerPoints <- function (A, b, type = rep("c", ncol(A)), nonneg = rep(TRUE, nco
p <- slices(A, b, type, nonneg)
p <- do.call(rbind, p)
tri <- t(geometry::convhulln(p))
#rgl.triangles(p[tri,1],p[tri,2],p[tri,3],col="gold2",alpha=.6)
#triangles3d(p[tri,1],p[tri,2],p[tri,3],col="gold2",alpha=.6)
idx <- unique(as.vector(tri))
p <- p[idx,]
#points3d(p, col="blue", size = 15)
Expand Down
38 changes: 20 additions & 18 deletions R/hull.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dimFace<-function(pts, dim = NULL) {
#' many points to test, it is most efficient to call this function once with the entire set.
#' @param vertices A \eqn{mxp} array of vertices of the convex hull. May contain redundant
#' (non-vertex) points.
#' @param hull Tessellation (or triangulation) generated by convhulln (only works if the dimension
#' @param hull Tessellation (or triangulation) generated by `convhulln` (only works if the dimension
#' of the hull is \eqn{p}). If hull is \code{NULL}, then it will be generated.
#' @param tol Tolerance on the tests for inclusion in the convex hull. You can think of `tol` as the
#' difference a point value may be different from the values of the hull, and still be perceived
Expand All @@ -77,7 +77,7 @@ dimFace<-function(pts, dim = NULL) {
#' warning will be given).
#'
#' @return An integer vector of length \eqn{n} with values 1 (inside hull), -1 (outside hull) or 0
#' (on hull to precision indicated by tol).
#' (on hull to precision indicated by `tol`).
#'
#' @author Lars Relund \email{lars@@relund.dk}
#' @export
Expand Down Expand Up @@ -146,7 +146,7 @@ inHull <- function(pts, vertices, hull=NULL,
p <- ncol(vertices) # dimension of points
cx <- nrow(pts) # points to test
d <- dimFace(vertices, dim = p)
if (d == 0) return(-as.integer(apply(pts, 1, FUN = function(x) abs(x - vertices[1,]) > tol)))
if (d == 0) return(-as.integer(apply(pts, 1, FUN = function(x) any(abs(x - vertices[1, ]) > tol))))
if (p == 1) { #1D space - check if between max and min
m <- min(vertices)
M <- max(vertices)
Expand Down Expand Up @@ -254,20 +254,20 @@ inHull <- function(pts, vertices, hull=NULL,

#' Find segments (lines) of a face.
#'
#' @param vertices A mxp array of vertices of the convex hull, as used by
#' convhulln.
#' @param hull Tessellation (or triangulation) generated by convhulln If hull is
#' @param vertices A `m x p` array of vertices of the convex hull, as used by
#' [geometry::convhulln()].
#' @param hull Tessellation (or triangulation) generated by [geometry::convhulln()] If hull is
#' left empty or not supplied, then it will be generated.
#' @param tol Tolerance on the tests for inclusion in the convex hull. You can
#' think of tol as the distance a point may possibly lie outside the hull, and
#' think of `tol` as the distance a point may possibly lie outside the hull, and
#' still be perceived as on the surface of the hull. Because of numerical slop
#' nothing can ever be done exactly here. I might guess a semi-intelligent
#' value of tol to be
#' value of `tol` to be
#'
#' tol = 1.e-13*mean(abs(vertices(:)))
#' `tol = 1.e-13*mean(abs(vertices(:)))`
#'
#' In higher dimensions, the numerical issues of floating point arithmetic
#' will probably suggest a larger value of tol.
#' will probably suggest a larger value of `tol`.
#'
#' @return A matrix with segments.
#' @author Lars Relund \email{lars@@relund.dk}
Expand Down Expand Up @@ -326,9 +326,9 @@ hullSegment <- function(vertices, hull=geometry::convhulln(vertices),
#' plus a value greater than on equal zero. If negative, consider the i'th column of the `pts`
#' minus a value greater than on equal zero.
#'
#' @note Assume that `pts` has been checked using [.checkPts].
#' @note Assume that `pts` has been checked using [.checkPts()].
#' @return The points merged with the points on the bounding box. The column `pt` equals 1 if
#' points from pts and zero otherwise.
#' points from `pts` and zero otherwise.
#' @export
#'
#' @examples
Expand Down Expand Up @@ -370,15 +370,14 @@ addRays <- function(pts, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5, directi
#' @param direction Ray direction. If i'th entry is positive, consider the i'th column of `pts`
#' plus a value greater than on equal zero (minimize objective $i$). If negative, consider the
#' i'th column of `pts` minus a value greater than on equal zero (maximize objective $i$).
#' @param tol Tolerance on std. dev. if using PCA.
#' @param tol Tolerance on standard deviation if using PCA.
#' @param m Minimum values of the bounding box.
#' @param M Maximum values of the bounding box.
#'
#' @return A list with \code{hull} equal a matrix with row indices of the vertices defining each
#' facet in the hull and \code{pts} equal the input points (and dummy points) and columns:
#' \code{pt}, true if a point in the original input; false if a dummy point (a point on a ray).
#' \code{vtx}, TRUE if a vertex in the hull.
#' @export
#'
#' @examples
#' ## 1D
Expand Down Expand Up @@ -427,6 +426,9 @@ addRays <- function(pts, m = apply(pts,2,min)-5, M = apply(pts,2,max)+5, directi
#' plotHull3D(pts, addRays = TRUE)
#' convexHull(pts, addRays = TRUE)
#' finalize3D()
#'
#' @importFrom rlang .data
#' @export
convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1,
tol = mean(mean(abs(pts)))*sqrt(.Machine$double.eps)*2,
m = apply(pts,2,min)-5, M = apply(pts,2,max)+5) {
Expand All @@ -435,7 +437,7 @@ convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1,
if (length(direction) != p) direction = rep(direction[1],p)
# print(set)
if (addRays) {
if (rgl::rgl.cur() > 0 & useRGLBBox) {
if (rgl::cur3d() > 0 & useRGLBBox) {
limits <- rgl::par3d()$bbox
for (i in 1:dim(pts)[1]) {
pt <- as.vector(pts[i,])
Expand Down Expand Up @@ -518,10 +520,10 @@ convexHull <- function(pts, addRays = FALSE, useRGLBBox = FALSE, direction = 1,
tmp <- dplyr::filter(set, .data$vtx | .data$pt, .preserve = TRUE)
if (nrow(set) != nrow(tmp)) {
tmp$newId <- 1:nrow(tmp)
mch <- dplyr::left_join(set, tmp, by = 'oldId') %>% dplyr::select(.data$newId)
mch <- dplyr::left_join(set, tmp, by = 'oldId') %>% dplyr::select("newId")
hull <- apply(hull, c(1,2), function(id) {if (is.na(id)) return(NA) else return(mch[id,1])} )
set <- dplyr::select(tmp, -.data$oldId, -.data$newId)
} else set <- dplyr::select(tmp, -.data$oldId)
set <- dplyr::select(tmp, -"oldId", -"newId")
} else set <- dplyr::select(tmp, -"oldId")
return(list(hull = hull, pts = set))
stop("Cannot find the vertices!")
}
Expand Down
28 changes: 15 additions & 13 deletions R/ndset.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
#' supported, non-extreme supported, non-supported.
#'
#' @param pts A data frame with a column for each variable in the solution
#' space (can also be a rangePoints).
#' space (can also be a `rangePoints`).
#' @param obj A p x n matrix(one row for each criterion).
#' @param crit Either max or min.
#' @param crit Either `max` or `min`.
#' @param labels If \code{NULL} or "n" don't add any labels (empty string). If
#' 'coord' labels are the solution space coordinates. Otherwise number all
#' equals `coord`, labels are the solution space coordinates. Otherwise number all
#' points from one based on the solution space points.
#'
#' @return A data frame with columns x1, ..., xn, z1, ..., zp, lbl (label), nD
#' (non-dominated), ext (extreme), nonExt (non-extreme supported).
#' @return A data frame with columns `x1, ..., xn, z1, ..., zp, lbl (label), nD
#' (non-dominated), ext (extreme), nonExt (non-extreme supported)`.
#' @author Lars Relund \email{lars@@relund.dk}
#' @export
#' @examples
Expand Down Expand Up @@ -160,15 +160,15 @@ criterionPoints<-function(pts, obj, crit, labels = "coord") {
#'
#' @param pts A data frame with points to add (a column for each objective).
#' @param nDSet A data frame with current non-dominated set (NULL is none yet). Column names of the
#' p objectives must be z1, ..., zp.
#' p objectives must be `z1, ..., zp`.
#' @param crit A max or min vector. If length one assume all objectives are optimized in the same
#' direction.
#' @param keepDom Keep dominated points in output.
#' @param dubND Duplicated non-dominated points are classified as non-dominated.
#' @param classify Non-dominated points are classified into supported extreme (se), supported
#' non-extreme (sne) and unsupported (us)
#' @param classify Non-dominated points are classified into supported extreme (`se`), supported
#' non-extreme (`sne`) and unsupported (`us`)
#'
#' @return A data frame with a column for each objective (`z` columns) and nd (non-dominated).
#' @return A data frame with a column for each objective (`z` columns) and `nd` (non-dominated).
#' Moreover if `classify` then columns `se`, `sne`, `us` and `cls`.
#'
#' @author Lars Relund \email{lars@@relund.dk}
Expand Down Expand Up @@ -422,10 +422,11 @@ addNDSet<-function(pts, nDSet = NULL, crit = "max", keepDom = FALSE, dubND = FAL
#' @param crit Either max or min.
#' @param keepDom Keep dominated points.
#'
#' @return A data frame with columns z1 and z2, nD (non-dominated),
#' ext (extreme), nonExt (non-extreme supported).
#' @return A data frame with columns z1 and z2, `nD` (non-dominated),
#' `ext` (extreme), `nonExt` (non-extreme supported).
#' @author Lars Relund \email{lars@@relund.dk}
#' @export
#' @keywords internal
#'
#' @examples
#' nDSet <- data.frame(z1=c(12,14,16,18), z2=c(18,16,12,4))
Expand Down Expand Up @@ -971,6 +972,7 @@ genNDSet <-
#' @note It is assumed that `pts` are nondominated.
#'
#' @return The ND set with classification columns.
#' @importFrom rlang .data
#' @export
#'
#' @examples
Expand Down Expand Up @@ -1053,8 +1055,8 @@ classifyNDSet <- function(pts, direction = 1) {
set1 <- set %>% left_join(x = set, y = pts[idx,], by = paste0("z", 1:p)) # match id of duplicates
set1 <- set1 %>%
dplyr::filter(!is.na(.data$id.y)) %>%
dplyr::mutate(id.x = .data$id.y) %>% dplyr::select(.data$z1:.data$id.x)
set <- bind_rows(set, pts[idx,]) %>% arrange(id) %>% select(-id)
dplyr::mutate(id.x = .data$id.y) %>% dplyr::select("z1":"id.x")
set <- dplyr::bind_rows(set, pts[idx,]) %>% dplyr::arrange(id) %>% dplyr::select(-id)
if (nrow(set1) > 0) for (i in 1:nrow(set1)) set[set1$id.x[i],] <- set1[i, 1:(p+4)]
return(set)
}

0 comments on commit 9135167

Please sign in to comment.