Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning due to R 4.0.0's matrix class #1

Open
linnykos opened this issue Jan 31, 2021 · 0 comments
Open

Warning due to R 4.0.0's matrix class #1

linnykos opened this issue Jan 31, 2021 · 0 comments

Comments

@linnykos
Copy link

In R 4.0.0 and newer, the matrix class also now implicitly are also arrays, which cause an unnecessary warning message in clp_solve to trigger. (See, for example: tidymodels/recipes#422) If this could be fixed, that'll be great!

library(clplite)
obj = c(1, 0, 0, 0, 2, 0, 0, -1)
A = matrix(c(
      3,   1,   0,  -2,  -1,   0,    0,   -1,
      0,   2, 1.1,   0,   0,   0,    0,    0,
      0,   0,   1,   0,   0,   1,    0,    0,
      0,   0,   0, 2.8,   0,   0, -1.2,    0,
    5.6,   0,   0,   0,   1,   0,    0,  1.9
), nrow = 5, byrow = TRUE)
constr_lb = c(2.5, -Inf,  4, 1.8,  3)
constr_ub = c(Inf,  2.1,  4,   5, 15)
var_lb    = c(2.5,   0,   0,   0, 0.5,   0,   0,   0)
var_ub    = c(Inf, 4.1, Inf, Inf,   4, Inf, Inf, 4.3)

clp_solve(obj, A, constr_lb, constr_ub, var_lb, var_ub, max = TRUE)

The result I get is as follows:

$solution
[1] 2.5000000 0.0000000 0.0000000 0.6428571 1.0000000 4.0000000
[7] 0.0000000 0.0000000

$objval
[1] 4.5

$status
[1] 0

Warning message:
In if (!(class(A) %in% supported_classes)) { :
  the condition has length > 1 and only the first element will be used

Here is my session info:

> devtools::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.3 (2020-10-10)
 os       macOS Big Sur 10.16         
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2021-01-31                  

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package          * version  date       lib source                         
 assertthat         0.2.1    2019-03-21 [1] CRAN (R 4.0.2)                 
 Biobase            2.50.0   2020-10-27 [1] Bioconductor                   
 BiocGenerics       0.36.0   2020-10-27 [1] Bioconductor                   
 BiocParallel       1.24.1   2020-11-06 [1] Bioconductor                   
 bitops             1.0-6    2013-08-17 [1] CRAN (R 4.0.2)                 
 callr              3.5.1    2020-10-13 [1] CRAN (R 4.0.2)                 
 cli                2.2.0    2020-11-20 [1] CRAN (R 4.0.2)                 
 clplite          * 0.1.0    2021-01-06 [1] Github (yixuan/clplite@cffcf11)
 crayon             1.3.4    2017-09-16 [1] CRAN (R 4.0.2)                 
 desc               1.2.0    2018-05-01 [1] CRAN (R 4.0.2)                 
 devtools           2.3.2    2020-09-18 [1] CRAN (R 4.0.2)                 
 digest             0.6.27   2020-10-24 [1] CRAN (R 4.0.2)                 
 ellipsis           0.3.1    2020-05-15 [1] CRAN (R 4.0.2)                 
 fansi              0.4.1    2020-01-08 [1] CRAN (R 4.0.2)                 
 fs                 1.5.0    2020-07-31 [1] CRAN (R 4.0.2)                 
 GenomeInfoDb       1.26.2   2020-12-08 [1] Bioconductor                   
 GenomeInfoDbData   1.2.4    2020-12-14 [1] Bioconductor                   
 GenomicRanges      1.42.0   2020-10-27 [1] Bioconductor                   
 glue               1.4.2    2020-08-27 [1] CRAN (R 4.0.2)                 
 IRanges            2.24.1   2020-12-12 [1] Bioconductor                   
 lattice            0.20-41  2020-04-02 [1] CRAN (R 4.0.3)                 
 lifecycle          0.2.0    2020-03-06 [1] CRAN (R 4.0.2)                 
 magrittr           2.0.1    2020-11-17 [1] CRAN (R 4.0.2)                 
 Matrix             1.3-0    2020-12-22 [1] CRAN (R 4.0.2)                 
 MatrixGenerics     1.2.0    2020-10-27 [1] Bioconductor                   
 matrixStats        0.58.0   2021-01-29 [1] CRAN (R 4.0.2)                 
 memoise            1.1.0    2017-04-21 [1] CRAN (R 4.0.2)                 
 pkgbuild           1.2.0    2020-12-15 [1] CRAN (R 4.0.2)                 
 pkgload            1.1.0    2020-05-29 [1] CRAN (R 4.0.2)                 
 prettyunits        1.1.1    2020-01-24 [1] CRAN (R 4.0.2)                 
 processx           3.4.5    2020-11-30 [1] CRAN (R 4.0.2)                 
 ps                 1.5.0    2020-12-05 [1] CRAN (R 4.0.2)                 
 purrr              0.3.4    2020-04-17 [1] CRAN (R 4.0.2)                 
 R6                 2.5.0    2020-10-28 [1] CRAN (R 4.0.2)                 
 Rcpp               1.0.6    2021-01-15 [1] CRAN (R 4.0.2)                 
 RCurl              1.98-1.2 2020-04-18 [1] CRAN (R 4.0.2)                 
 remotes            2.2.0    2020-07-21 [1] CRAN (R 4.0.2)                 
 rlang              0.4.10   2020-12-30 [1] CRAN (R 4.0.2)                 
 rprojroot          2.0.2    2020-11-15 [1] CRAN (R 4.0.2)                 
 rstudioapi         0.13     2020-11-12 [1] CRAN (R 4.0.2)                 
 S4Vectors          0.28.1   2020-12-09 [1] Bioconductor                   
 sessioninfo        1.1.1    2018-11-05 [1] CRAN (R 4.0.2)                 
 testthat           3.0.1    2020-12-17 [1] CRAN (R 4.0.2)                 
 usethis            2.0.0    2020-12-10 [1] CRAN (R 4.0.2)                 
 withr              2.3.0    2020-09-22 [1] CRAN (R 4.0.2)                 
 XVector            0.30.0   2020-10-28 [1] Bioconductor                   
 zlibbioc           1.36.0   2020-10-28 [1] Bioconductor                   

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant