1212# #
1313# # Base R only -- no external dependencies -- so it runs even if a package
1414# # failed to install. CORE = the four built-in solvers used by most chapters;
15- # # EXTRA = scip (ch.6 , MI-SOCP) and Uno + sparsediff (ch.8 , nonlinear) -- both
15+ # # EXTRA = scip (ch.11 , MI-SOCP) and Uno + sparsediff (ch.14 , nonlinear) -- both
1616# # are hands-on chapters, but if an EXTRA fails you can still do everything else.
1717# # ---------------------------------------------------------------------------
1818
@@ -21,7 +21,7 @@ line <- function(tag, label, detail = "") cat(sprintf(" [%s] %-28s %s\n", tag,
2121hdr <- function (x ) cat(sprintf(" \n == %s ==\n " , x ))
2222
2323core_ok <- TRUE # CVXR + four built-in solvers + helpers
24- extra_ok <- TRUE # scip (ch.6 ) and Uno + sparsediff (ch.8 )
24+ extra_ok <- TRUE # scip (ch.11 ) and Uno + sparsediff (ch.14 )
2525
2626# # --- 1. R version --------------------------------------------------------
2727hdr(" R version" )
@@ -48,10 +48,10 @@ core_ok <- check_pkg("highs", "1.14") && core_ok # CVXR requires highs >= 1.1
4848# # Helper packages used by the example chapters (CRAN)
4949for (h in c(" ggplot2" , " tidyr" , " nnls" , " glmnet" , " boot" , " png" , " bench" ))
5050 core_ok <- check_pkg(h ) && core_ok
51- # # Extra solvers for chapters 6 and 8 (CRAN, in CVXR Enhances -> separate installs)
52- extra_ok <- check_pkg(" scip" , " 1.10" ) && extra_ok # ch.6 MI-SOCP
53- extra_ok <- check_pkg(" Uno" , " 2.7.3" ) && extra_ok # ch.8 nonlinear (pulls rmumps)
54- extra_ok <- check_pkg(" sparsediff" , " 0.4.0" ) && extra_ok # ch.8 autodiff
51+ # # Extra solvers for chapters 11 and 14 (CRAN, in CVXR Enhances -> separate installs)
52+ extra_ok <- check_pkg(" scip" , " 1.10" ) && extra_ok # ch.11 MI-SOCP
53+ extra_ok <- check_pkg(" Uno" , " 2.7.3" ) && extra_ok # ch.14 nonlinear (pulls rmumps)
54+ extra_ok <- check_pkg(" sparsediff" , " 0.4.0" ) && extra_ok # ch.14 autodiff
5555
5656# # --- 3. Functional solve test: the four core solvers ---------------------
5757# # Tiny LP: minimize sum(x) s.t. x >= 1, x in R^2 -> optimal value 2.
@@ -75,9 +75,9 @@ if (requireNamespace("CVXR", quietly = TRUE)) {
7575 core_ok <- FALSE
7676}
7777
78- # # --- 4. Chapter 6 : SCIP integer solve (MI-SOCP-capable interface) - -------
78+ # # --- 4. Chapter 11 : SCIP integer solve (MI-SOCP-capable interface) -------
7979# # Tiny integer LP: minimize sum(x) s.t. x >= 1.5, integer -> value 4.
80- hdr(" Chapter 6 solver (SCIP integer solve, expect value 4)" )
80+ hdr(" Chapter 11 solver (SCIP integer solve, expect value 4)" )
8181if (requireNamespace(" CVXR" , quietly = TRUE ) &&
8282 requireNamespace(" scip" , quietly = TRUE )) {
8383 xi <- Variable(2 , integer = TRUE )
@@ -89,27 +89,27 @@ if (requireNamespace("CVXR", quietly = TRUE) &&
8989 line(mark(res $ ok ), " SCIP" , res $ detail )
9090 if (! isTRUE(res $ ok )) extra_ok <- FALSE
9191} else {
92- line(" WARN" , " SCIP" , " scip not installed -- needed for chapter 6 " )
92+ line(" WARN" , " SCIP" , " scip not installed -- needed for chapter 11 " )
9393 extra_ok <- FALSE
9494}
9595
96- # # --- 5. Chapter 8 : DNLP backends present - --------------------------------
97- hdr(" Chapter 8 backends (Uno + sparsediff)" )
96+ # # --- 5. Chapter 14 : DNLP backends present --------------------------------
97+ hdr(" Chapter 14 backends (Uno + sparsediff)" )
9898dnlp_ok <- requireNamespace(" Uno" , quietly = TRUE ) &&
9999 requireNamespace(" sparsediff" , quietly = TRUE )
100100line(if (dnlp_ok ) " PASS" else " WARN" , " Uno + sparsediff" ,
101- if (dnlp_ok ) " loadable" else " missing -- needed for chapter 8 (ipopt NOT needed)" )
101+ if (dnlp_ok ) " loadable" else " missing -- needed for chapter 14 (ipopt NOT needed)" )
102102if (! dnlp_ok ) extra_ok <- FALSE
103103
104104# # --- Summary -------------------------------------------------------------
105105hdr(" Summary" )
106106cat(sprintf(" CORE (most chapters) : %s\n " , if (core_ok ) " READY" else " NOT READY" ))
107- cat(sprintf(" EXTRAS (chapters 6 and 8) : %s\n " , if (extra_ok ) " READY" else " incomplete" ))
107+ cat(sprintf(" EXTRAS (chapters 11 and 14) : %s\n " , if (extra_ok ) " READY" else " incomplete" ))
108108if (! core_ok ) {
109109 cat(" \n -> Fix CORE first:\n " )
110110 cat(" install.packages(c(\" CVXR\" ,\" ggplot2\" ,\" tidyr\" ,\" nnls\" ,\" glmnet\" ,\" boot\" ,\" png\" ,\" bench\" ))\n " )
111111} else if (! extra_ok ) {
112- cat(" \n -> Core is ready (most chapters work). For chapters 6 and 8 also:\n " )
112+ cat(" \n -> Core is ready (most chapters work). For chapters 11 and 14 also:\n " )
113113 cat(" install.packages(c(\" scip\" , \" Uno\" , \" sparsediff\" ))\n " )
114114} else {
115115 cat(" \n All set -- every chapter is ready.\n " )
0 commit comments