Skip to content

Commit 7131a31

Browse files
committed
Complete participant setup: repo cloning (RStudio/Positron/Git/ZIP), Quarto note, fix stale chapter numbers
- index.qmd: new 'Getting the materials' subsection naming/linking the repo with four clone paths (RStudio, Positron, terminal, Download ZIP) and a Quarto-CLI note; drop phantom '(or .R)' (no .R chapter scripts exist) - README.md: name RStudio or Positron; expand the bare clone step into the same four paths with inline URL + Quarto note; fix layout table to 01-16 - setup_check.R: correct stale chapter numbers throughout (MI-SOCP/SCIP is ch.11, DNLP/Uno+sparsediff is ch.14; were ch.6/ch.8 from the old layout)
1 parent 9105ecb commit 7131a31

3 files changed

Lines changed: 58 additions & 20 deletions

File tree

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@ and uses **CRAN solvers only**.
1313
1414
## For participants
1515

16-
1. **Install R ≥ 4.3.0** and a recent [RStudio](https://posit.co/download/rstudio-desktop/).
17-
2. Clone or download this repository and open `cvxr-tutorial-2026.Rproj` in RStudio.
16+
1. **Install R ≥ 4.3.0** and a recent IDE ---
17+
[RStudio](https://posit.co/download/rstudio-desktop/) or
18+
[Positron](https://positron.posit.co).
19+
2. **Get the materials** (this repository):
20+
21+
- **RStudio:** *File → New Project → Version Control → Git*, paste
22+
`https://github.com/bnaras/cvxr_tutorial.git`, then open `cvxr-tutorial-2026.Rproj`.
23+
- **Positron:** Command Palette → *Git: Clone* → paste the same URL → open the folder.
24+
- **Terminal:** `git clone https://github.com/bnaras/cvxr_tutorial.git`
25+
- **No Git:** *Code → Download ZIP* on the repo page and unzip.
26+
27+
You also need the [Quarto CLI](https://quarto.org/docs/get-started/) (≥ 1.4) to
28+
render chapters or the whole book. RStudio bundles Quarto; Positron and terminal
29+
users install it once from that link. (Running individual code chunks needs no
30+
render step.)
1831
3. Install the packages (CRAN only):
1932

2033
```r
@@ -53,7 +66,7 @@ needs no LaTeX. Rendered output goes to `_book/`.
5366
| Path | What |
5467
|------|------|
5568
| `index.qmd` | Preface |
56-
| `01-…``10-…qmd` | Chapters (see `_quarto.yml` for the structure) |
69+
| `01-…``16-…qmd` | Chapters (see `_quarto.yml` for the structure) |
5770
| `setup_check.R` | Pre-tutorial environment check |
5871
| `_check_status.R` | Helper sourced by example chunks |
5972
| `references.bib`, `cvxr.bib` | Bibliography |

index.qmd

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ that will interest experienced optimizers too; exercises marked with a star
2727

2828
This is a **hands-on** book. You are meant to *run the code*, not just read it.
2929

30-
- Open the accompanying **RStudio project** and work through each chapter's `.qmd`
31-
(or `.R`) by **executing the code chunks** as you read. You do not need to type
32-
anything --- click *Run* (or press `Ctrl/Cmd+Enter`) and watch what happens.
30+
- Open the accompanying **project** (see *Getting the materials* below) and work
31+
through each chapter's `.qmd` by **executing the code chunks** as you read. You do
32+
not need to type anything --- click *Run* (or press `Ctrl/Cmd+Enter`) and watch what
33+
happens.
3334
- Each hands-on chapter ends with **exercises**. Try them, then click to reveal
3435
the solution:
3536

@@ -39,6 +40,30 @@ Solutions look like this --- the code and its output are right here, hidden unti
3940
you want them.
4041
:::
4142

43+
## Getting the materials
44+
45+
All the materials --- chapter sources, data, and the `setup_check.R` script below ---
46+
live in one Git repository:
47+
[github.com/bnaras/cvxr_tutorial](https://github.com/bnaras/cvxr_tutorial). Get a copy
48+
in whichever way suits you:
49+
50+
- **RStudio:** *File → New Project → Version Control → Git*, paste
51+
`https://github.com/bnaras/cvxr_tutorial.git` as the repository URL, and click
52+
*Create Project*. Then open `cvxr-tutorial-2026.Rproj`.
53+
- **Positron:** open the Command Palette (`Ctrl/Cmd+Shift+P`), run *Git: Clone*, paste
54+
the same URL, and open the cloned folder.
55+
- **Terminal:** `git clone https://github.com/bnaras/cvxr_tutorial.git`, then open the
56+
folder in your editor.
57+
- **No Git?** Use the green *Code → Download ZIP* button on the repository page and
58+
unzip it.
59+
60+
You will also need **[Quarto](https://quarto.org/docs/get-started/)** (≥ 1.4) to render
61+
the book or preview chapters. **RStudio bundles Quarto**, so there is nothing extra to
62+
install there. **Positron** and plain-terminal users should install the Quarto CLI
63+
once from the link above. You can still *run individual code chunks* without rendering
64+
anything --- Quarto is only required when you render a whole chapter or the full book
65+
(`quarto render`).
66+
4267
## Installation
4368

4469
Everything in this tutorial runs on **CRAN packages only**. Two lines install all

setup_check.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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,
2121
hdr <- function(x) cat(sprintf("\n== %s ==\n", x))
2222

2323
core_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 --------------------------------------------------------
2727
hdr("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)
4949
for (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)")
8181
if (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)")
9898
dnlp_ok <- requireNamespace("Uno", quietly = TRUE) &&
9999
requireNamespace("sparsediff", quietly = TRUE)
100100
line(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)")
102102
if (!dnlp_ok) extra_ok <- FALSE
103103

104104
## --- Summary -------------------------------------------------------------
105105
hdr("Summary")
106106
cat(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"))
108108
if (!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

Comments
 (0)