diff --git a/.gitignore b/.gitignore index 1458c96a..24de750f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ vignettes/*.pdf # My stuff inst/stuff + +# Makevars is generated +src/Makevars \ No newline at end of file diff --git a/docs/404.html b/docs/404.html index e3f50325..a11e1f49 100644 --- a/docs/404.html +++ b/docs/404.html @@ -12,7 +12,7 @@ - + @@ -39,7 +39,7 @@
@@ -98,7 +98,7 @@The first two examples are from the original Clarabel -documentation and the third is from SCS.
+The first two examples are from the original Clarabel documentation and the third is +from SCS.
+cat(sprintf("Solution: (x1, x2) = (%f, %f)\n", s$x[1], s$x[2]))
#> Solution: (x1, x2) = (0.428571, 0.214286)
++P <- Matrix::Matrix(2 * c(0, 0, 0, 1), nrow = 2, ncol = 2, sparse = TRUE) P <- as(P, "symmetricMatrix") # P needs to be a symmetric matrix q <- c(0, 0) @@ -212,8 +213,9 @@
2.3. Solutions <- clarabel(A = A, b = b, q = q, P = P, cones = cones) cat(sprintf("Solution status, description: = (%d, %s)\n", s$status, solver_status_descriptions()[s$status])) -#> Solution status, description: = (2, Solver terminated with a solution.) -cat(sprintf("Solution (x1, x2) = (%f, %f)\n", s$x[1], s$x[2])) +#> Solution status, description: = (2, Solver terminated with a solution.)
\[
\begin{aligned}
\text{mat}(s) = \begin{bmatrix}
@@ -291,7 +293,7 @@ 3. Semidefinite Cone Programming
Below are two functions to implement both \(\text{vec}\) and \(\text{mat}\).
-++#' Return an vectorization of symmetric matrix using the upper triangular part, #' still in column order. #' @param S a symmetric matrix @@ -353,13 +355,16 @@
3.1. Example\(x \in \mathbb{R}^n\) and -\(S \in \mathbb{R}^{k \times k}\) +\(S \in +\mathbb{R}^{k \times k}\)
\[ B - \sum_{i=1}^n \mathcal{A}_i x_i = S \succeq 0 \]
where data \(B, \mathcal{A}_1, \ldots, -\mathcal{A}_n \in \mathbb{R}^{k \times k}\) are symmetric. We can -write this in the canonical form over a new variable \(s \in \mathcal{S}_+^k\):
+\mathcal{A}_n \in \mathbb{R}^{k +\times k}\) are symmetric. We can write this in the canonical +form over a new variable \(s \in +\mathcal{S}_+^k\):\[ \begin{aligned} \begin{align} @@ -371,8 +376,8 @@
+is linear, where \(b = +\text{vec}(B)\) and3.1. Example\(\text{vec}\)
-is linear, where \(b = \text{vec}(B)\) -and\[ A = \begin{bmatrix} @@ -388,7 +393,7 @@
3.1. Example
++#> Solution status, description: = (2, Solver terminated with a solution.)q <- c(1, -1, 1) # objective: x_1 - x2 + x_3 A11 <- matrix(c(-7, -11, -11, 3), nrow = 2) A12 <- matrix(c(7, -18, -18, 8), nrow = 2) @@ -407,22 +412,122 @@
3.1. Example) b <- c(vec(B1), vec(B2)) # stack both psd constraints cones <- list(s = c(2, 3)) # cone dimensions -s <- clarabel(A = A, b = b, q = q, cone = cones) +s <- clarabel(A = A, b = b, q = q, cones = cones) cat(sprintf("Solution status, description: = (%d, %s)\n", s$status, solver_status_descriptions()[s$status])) -#> Solution status, description: = (2, Solver terminated with a solution.) -cat(sprintf("Solution (x1, x2, x3) = (%f, %f, %f)\n", s$x[1], s$x[2], s$x[3])) -#> Solution (x1, x2, x3) = (-0.367752, 1.898333, -0.887460)
The following cones can be specified in Clarabel.
+Parameter | +Type | +Length | +Description | +Definition (per parameter element) | +
---|---|---|---|---|
z | +integer | +1 | +Number of primal zero cones (dual free cones), which +corresponds to the primal equality constraints | +\(\{ 0 \}^{z}\) | +
l | +integer | +1 | +Number of linear cones (non-negative cones) | +\(\{ x \in \mathbb{R}^{l} : +x_i \ge 0, \forall i=1,\dots,l \}\) | +
q | +integer | +>= 1 | +Vector of second-order cone sizes | +\(\{ (t,x) \in +\mathbb{R}^{q} : \lVert x\rVert_2 \leq t \}\) | +
s | +integer | +>= 1 | +Vector of positive semidefinite cone sizes | +Upper triangular part of the positive semidefinite cone +\(S^s_+\). The elements \(x\) of this cone represent the columnwise +stacking of the upper triangular part of a positive semidefinite matrix +\(X \in S^s_+\), so that \(x \in R^d\) with \(d = s(s+1)/2\) + | +
ep | +integer | +1 | +Number of primal exponential cones | +\(\{(x, y, z) : y > 0,~~ +ye^{x/y} \le z \}\) | +
p | +numeric | +>= 1 | +Vector of primal power cone parameters | ++\(\{(x, y, z) : x^p y^{(1-p)} +\ge \lVert z\rVert,~ (x,y) \ge 0 \}\) with \(p \in (0,1)\) + | +
gp | +list | +>= 1 | +List of named lists of two items, a : the
+numeric vector of at least 2 exponent terms, and n : an
+integer dimension of generalized power cone parameters |
++\(\{(x, y) \in R^{len(a)} +\times R^n : \prod\limits_{a_i \in a} x_i^{a_i} \ge \lVert y\rVert_2,~ x +\ge 0 \}\) with \(a_i \in +(0,1)\) and \(\sum a_i = +1\) + | +
Generalized power cone parameters are specified as list of two-item +lists, with component named \(a\) +denoting the exponents and the named component \(n\) denoting the dimension.
+One can specify cones in any order if strict_cone_order
+is set to FALSE
in the call to clarabel()
but
+one has to ensure that parameter types are strictly specified for the
+values, e.g. 5L
for integers, 0.
for reals
+etc.
Clarabel has a number of parameters that control its behavior,
including verbosity, time limits, and tolerances; see help on
clarabel_control()
. As an example, in the last problem, we
can reduce the number of iterations.
++P <- Matrix::Matrix(2 * c(0, 0, 0, 1), nrow = 2, ncol = 2, sparse = TRUE) P <- as(P, "symmetricMatrix") # P needs to be a symmetric matrix q <- c(0, 0) @@ -433,8 +538,9 @@
4. Control parameters= list(max_iter = 3)) ## Reduced number of iterations cat(sprintf("Solution status, description: = (%d, %s)\n", s$status, solver_status_descriptions()[s$status])) -#> Solution status, description: = (5, Solver terminated with a solution (reduced accuracy)) -cat(sprintf("Solution (x1, x2) = (%f, %f)\n", s$x[1], s$x[2])) +#> Solution status, description: = (5, Solver terminated with a solution (reduced accuracy))
+cat(sprintf("Solution (x1, x2) = (%f, %f)\n", s$x[1], s$x[2])) #> Solution (x1, x2) = (1.000000, -0.999998)
Note the different status, which should always be checked in code.
@@ -458,7 +564,7 @@4. Control parameters -
Site built with pkgdown 2.0.7.
+Site built with pkgdown 2.0.9.
Goulart P, Chen Y (2021). -“Clarabel: A Library for Optimization and Control.” -https://oxfordcontrol.github.io/ClarabelDocs/stable/. +
Goulart PJ, Chen Y (2024). +“Clarabel: An interior-point solver for conic programs with quadratic objectives.” +doi:10.48550/arXiv.2405.12762, 2405.12762.
-@Misc{, - title = {Clarabel: A Library for Optimization and Control}, - author = {Paul Goulart and Yuwen Chen}, - year = {2021}, - url = {https://oxfordcontrol.github.io/ClarabelDocs/stable/}, +@Misc{Clarabel_2024, + title = {Clarabel: An interior-point solver for conic programs with quadratic objectives}, + author = {Paul J. Goulart and Yuwen Chen}, + year = {2024}, + eprint = {2405.12762}, + archiveprefix = {arXiv}, + doi = {10.48550/arXiv.2405.12762}, + primaryclass = {math.OC}, +}+Garstka M, Cannon M, Goulart P (2020). +“A clique graph based merging strategy for decomposable SDPs.” +In IFAC-PapersOnLine, volume 53 number 2, 7355-7361. +doi:10.1016/j.ifacol.2020.12.1255, 21th IFAC World Congress. +
+@InProceedings{Garstka_2020, + author = {Michael Garstka and Mark Cannon and Paul Goulart}, + title = {A clique graph based merging strategy for decomposable {SDPs}}, + booktitle = {IFAC-PapersOnLine}, + year = {2020}, + note = {21th IFAC World Congress}, + number = {2}, + pages = {7355-7361}, + volume = {53}, + doi = {10.1016/j.ifacol.2020.12.1255}, + issn = {2405-8963}, + journal = {IFAC-PapersOnLine}, +}+Chen Y, Goulart P (2023). +“An Efficient IPM Implementation for A Class of Nonsymmetric Cones.” +doi:10.48550/arXiv.2305.12275, 2305.12275. +
+@Misc{chen2023efficient, + title = {An Efficient IPM Implementation for A Class of Nonsymmetric Cones}, + author = {Yuwen Chen and Paul Goulart}, + year = {2023}, + eprint = {2305.12275}, + archiveprefix = {arXiv}, + doi = {10.48550/arXiv.2305.12275}, + primaryclass = {math.OC}, }
Clarabel is a versatile interior point solver for convex programs using a new homogeneous embedding. It solves solves linear programs (LPs), quadratic programs (QPs), second-order cone programs (SOCPs), and problems with exponential and power cone constraints. For quadratic objectives, unlike interior point solvers based on the standard homogeneous self-dual embedding (HSDE) model, Clarabel handles quadratic objective without requiring any epigraphical reformulation of its objective function. It can therefore be significantly faster than other HSDE-based solvers for problems with quadratic objective functions. Infeasible problems are detected using a homogeneous embedding technique. See https://oxfordcontrol.github.io/ClarabelDocs/stable/.
+Clarabel is a versatile interior point solver for convex programs using a new homogeneous embedding. It solves solves linear programs (LPs), quadratic programs (QPs), second-order cone programs (SOCPs), and problems with exponential and power cone constraints. For quadratic objectives, unlike interior point solvers based on the standard homogeneous self-dual embedding (HSDE) model, Clarabel handles quadratic objective without requiring any epigraphical reformulation of its objective function. It can therefore be significantly faster than other HSDE-based solvers for problems with quadratic objective functions. Infeasible problems are detected using a homogeneous embedding technique. See https://clarabel.org/stable/.
Useful links:
The table below shows the cone parameter specifications
Parameter | Type | Length | Description | |
z | integer | \(1\) | number of primal zero cones (dual free cones), | |
which corresponds to the primal equality constraints | ||||
l | integer | \(1\) | number of linear cones (non-negative cones) | |
q | integer | \(\geq1\) | vector of second-order cone sizes | |
s | integer | \(\geq1\) | vector of positive semidefinite cone sizes | |
ep | integer | \(1\) | number of primal exponential cones | |
p | numeric | \(\geq1\) | vector of primal power cone parameters |
The table below shows the cone parameter specifications. Mathematical definitions are in the vignette.
Parameter | Type | Length | Description | |
z | integer | \(1\) | number of primal zero cones (dual free cones), | |
which corresponds to the primal equality constraints | ||||
l | integer | \(1\) | number of linear cones (non-negative cones) | |
q | integer | \(\ge 1\) | vector of second-order cone sizes | |
s | integer | \(\ge 1\) | vector of positive semidefinite cone sizes | |
ep | integer | \(1\) | number of primal exponential cones | |
p | numeric | \(\ge 1\) | vector of primal power cone parameters | |
gp | list | \(\ge 1\) | list of named lists of two items, a : a numeric vector of at least 2 exponent terms in the product summing to 1, and n : an integer dimension of generalized power cone parameters |
When the parameter strict_cone_order
is FALSE
, one can specify
@@ -159,7 +159,8 @@
list(z1 = 2L, l1 = 2L, q1 = 2L, zb = 3L, qx = 3L)
, indicating a zero
cone of size 2, followed by a linear cone of size 2, followed by a second-order
cone of size 2, followed by a zero cone of size 3, and finally a second-order
-cone of size 3.
+cone of size 3. Generalized power cones parameters have to specified as named lists, e.g., list(z = 2L, gp1 = list(a = c(0.3, 0.7), n = 3L), gp2 = list(a = c(0.5, 0.5), n = 1L))
.
+Note that when strict_cone_order = FALSE
, types of cone parameters such as integers, reals have to be explicit since the parameters are directly passed to the Rust interface with no sanity checks.!
whether to enable presolvle (TRUE
)
whether to enable chordal decomposition for SDPs (FALSE
)
chordal decomposition merge method, one of 'none'
, 'parent_child'
or 'clique_graph'
, for SDPs ('none'
)
a boolean flag for SDPs indicating whether to assemble decomposed system in compact form for SDPs (FALSE
)
a boolean flag indicating complete PSD dual variables after decomposition for SDPs
Interface to Clarabel solver implemented in Rust.
Interface to 'Clarabel', an interior point conic solver